byte[] getByteBodyContents() { if (bytePayload != null) return bytePayload; String body = null; if (payload != null) { body = payload; } else if (files.isEmpty()) { body = URLUtils.formURLEncodeMap(bodyParams); } else { byte res[] = null; try { res = URLUtils.doFormDataEncode(bodyParams, files, boundary).toByteArray(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return res; } try { return body.getBytes(getCharset()); } catch (UnsupportedEncodingException uee) { throw new OAuthException("Unsupported Charset: " + getCharset(), uee); } }