twitter4j.internal.http
Class HttpResponse

java.lang.Object
  extended by twitter4j.internal.http.HttpResponse
Direct Known Subclasses:
HttpResponseImpl

public abstract class HttpResponse
extends Object

A data class representing HTTP Response

Author:
Yusuke Yamamoto - yusuke at mac.com

Constructor Summary
HttpResponse(HttpClientConfiguration conf)
           
 
Method Summary
 JSONArray asJSONArray()
          Returns the response body as twitter4j.internal.org.json.JSONArray.
Disconnects the internal HttpURLConnection silently.
 JSONObject asJSONObject()
          Returns the response body as twitter4j.internal.org.json.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()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HttpResponse

public HttpResponse(HttpClientConfiguration conf)
Method Detail

getStatusCode

public int getStatusCode()

getResponseHeader

public abstract String getResponseHeader(String name)

getResponseHeaderFields

public abstract Map<String,List<String>> getResponseHeaderFields()

asStream

public 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.

Disconnects the internal HttpURLConnection silently.

Returns:
response body stream
Throws:
TwitterException
See Also:
disconnect()

asString

public String asString()
                throws TwitterException
Returns the response body as string.
Disconnects the internal HttpURLConnection silently.

Returns:
response body
Throws:
TwitterException

asJSONObject

public JSONObject asJSONObject()
                        throws TwitterException
Returns the response body as twitter4j.internal.org.json.JSONObject.
Disconnects the internal HttpURLConnection silently.

Returns:
response body as twitter4j.internal.org.json.JSONObject
Throws:
TwitterException

asJSONArray

public JSONArray asJSONArray()
                      throws TwitterException
Returns the response body as twitter4j.internal.org.json.JSONArray.
Disconnects the internal HttpURLConnection silently.

Returns:
response body as twitter4j.internal.org.json.JSONArray
Throws:
TwitterException

asReader

public Reader asReader()

disconnect

public abstract void disconnect()
                         throws IOException
Throws:
IOException

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2012. All Rights Reserved.