Android Utililty Methods HttpResponse Read

List of utility methods to do HttpResponse Read


The list of methods to do HttpResponse Read are organized into topic(s).


booleanreadBody(HttpResponse resp, ByteBuffer target)
read Body
final HttpEntity entity = resp.getEntity();
if (entity == null) {
    throw new IllegalArgumentException(
            "HTTP entity may not be null");
final InputStream is = entity.getContent();
if (is == null) {
    return false;
JSONObjectdecodeJSONResponse(HttpResponse resp)
decode JSON Response
InputStream is = null;
try {
    is = resp.getEntity().getContent();
} catch (IOException e) {
    Log.d(TAG, "unable to get content from response entity");
    return null;
String in = convertStreamToString(is);
JSONObject json = null;
try {
    json = new JSONObject(in);
} catch (JSONException e) {
    Log.d(TAG, "could not decode JSON response from: " + in);
return json;
MaphandleJsonResponse(HttpResponse response)
handle Json Response
JSONObject oauthLoginResponse = null;
String contentType = response.getEntity().getContentType()
try {
    oauthLoginResponse = new JSONObject(
} catch (ParseException e1) {