public abstract class HttpResponse extends Object
Constructor and Description |
---|
HttpResponse(HttpClientConfiguration conf) |
Modifier and Type | Method and Description |
---|---|
JSONArray |
asJSONArray()
Returns the response body as twitter4j.JSONArray.
Disconnects the internal HttpURLConnection silently. |
JSONObject |
asJSONObject()
Returns the response body as twitter4j.JSONObject.
Disconnects the internal HttpURLConnection silently. |
Reader |
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. |
abstract void |
disconnect() |
abstract String |
getResponseHeader(String name) |
abstract Map<String,List<String>> |
getResponseHeaderFields() |
int |
getStatusCode() |
String |
toString() |
public HttpResponse(HttpClientConfiguration conf)
public int getStatusCode()
public InputStream asStream()
Disconnects the internal HttpURLConnection silently.
disconnect()
public String asString() throws TwitterException
TwitterException
- when there is any network issue upon response body consumptionpublic JSONObject asJSONObject() throws TwitterException
TwitterException
- when the response body is not in JSON Object formatpublic JSONArray asJSONArray() throws TwitterException
TwitterException
- when the response body is not in JSON Array formatpublic Reader asReader()
public abstract void disconnect() throws IOException
IOException
Copyright © 2018. All rights reserved.