public class Response extends Object
| Constructor and Description |
|---|
Response() |
Response(HttpURLConnection con) |
| Modifier and Type | Method and Description |
|---|---|
Document |
asDocument()
Returns the response body as org.w3c.dom.Document.
Disconnects the internal HttpURLConnection silently. |
org.json.JSONArray |
asJSONArray()
Returns the response body as sinat4j.org.json.JSONArray.
Disconnects the internal HttpURLConnection silently. |
org.json.JSONObject |
asJSONObject()
Returns the response body as sinat4j.org.json.JSONObject.
Disconnects the internal HttpURLConnection silently. |
InputStreamReader |
asReader() |
InputStream |
asStream()
Returns the response stream.
This method cannot be called after calling asString() or asDcoument() It is suggested to call disconnect() after consuming the stream. |
String |
asString()
Returns the response body as string.
Disconnects the internal HttpURLConnection silently. |
void |
disconnect() |
String |
getResponseAsString() |
String |
getResponseHeader(String name) |
int |
getStatusCode() |
void |
setResponseAsString(String responseAsString) |
void |
setStatusCode(int statusCode) |
String |
toString() |
static String |
unescape(String original)
Unescape UTF-8 escaped characters to string.
|
public Response()
public Response(HttpURLConnection con) throws IOException
IOExceptionpublic int getStatusCode()
public InputStream asStream()
WeiboExceptiondisconnect()public String asString() throws WeiboException
WeiboExceptionpublic Document asDocument() throws WeiboException
WeiboExceptionpublic org.json.JSONObject asJSONObject()
throws WeiboException
WeiboExceptionpublic org.json.JSONArray asJSONArray()
throws WeiboException
WeiboExceptionpublic InputStreamReader asReader()
public void disconnect()
public static String unescape(String original)
original - The string to be unescaped.public String getResponseAsString()
public void setResponseAsString(String responseAsString)
public void setStatusCode(int statusCode)
Copyright © 2013. All Rights Reserved.