public class ResponseUtil extends Object
HttpResponse| Modifier and Type | Field and Description |
|---|---|
static int |
BUFFER_SIZE
The Constant BUFFER_SIZE.
|
| Constructor and Description |
|---|
ResponseUtil() |
| Modifier and Type | Method and Description |
|---|---|
static String |
formatJSON(String json)
Returns a Json
String in human-readable form. |
static InputStream |
getInputStream(org.apache.http.HttpResponse response)
Returns a String representation of the response.
|
static com.google.gson.JsonArray |
getJsonArray(org.apache.http.HttpResponse response)
Returns a
JsonArray representation of the response. |
static com.google.gson.JsonElement |
getJsonElement(org.apache.http.HttpResponse response)
Return a
JsonElement representation of the response. |
static com.google.gson.JsonObject |
getJsonObject(org.apache.http.HttpResponse response)
Returns a
JsonObject representation of the response. |
static <T> T |
getObject(org.apache.http.HttpResponse response,
Class<T> type)
Returns
|
static String |
getString(org.apache.http.HttpResponse response)
Returns a String representation of the response.
|
public static final int BUFFER_SIZE
public static String formatJSON(String json)
String in human-readable form.json - the Json stringpublic static com.google.gson.JsonElement getJsonElement(org.apache.http.HttpResponse response)
throws IOException
JsonElement representation of the response.response - the HttpResponseIOException - Signals that an I/O exception has occurred.public static com.google.gson.JsonArray getJsonArray(org.apache.http.HttpResponse response)
throws IOException
JsonArray representation of the response.response - an HTTP responseIOException - If an input or output
exception occurredpublic static com.google.gson.JsonObject getJsonObject(org.apache.http.HttpResponse response)
throws IOException
JsonObject representation of the response.response - an HTTP responseIOException - If an input or output
exception occurredpublic static String getString(org.apache.http.HttpResponse response) throws IOException
response - an HTTP responseIOException - network errorpublic static InputStream getInputStream(org.apache.http.HttpResponse response) throws IOException
response - an HTTP responseIOException - network errorpublic static <T> T getObject(org.apache.http.HttpResponse response,
Class<T> type)
throws IOException
T - the generic type to use when parsing the responseresponse - the http responsetype - the type of the responseIOException - Signals that an I/O exception has occurred.Copyright © 2015. All rights reserved.