twitter4j.internal.http
Class HttpResponse

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

public abstract class HttpResponse
extends java.lang.Object

A data class representing HTTP Response

Author:
Yusuke Yamamoto - yusuke at mac.com

Constructor Summary
HttpResponse()
           
 
Method Summary
 org.w3c.dom.Document asDocument()
          Returns the response body as org.w3c.dom.Document.
Disconnects the internal HttpURLConnection silently.
 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.
 java.io.InputStreamReader asReader()
           
 java.io.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.
 java.lang.String asString()
          Returns the response body as string.
Disconnects the internal HttpURLConnection silently.
abstract  void disconnect()
           
abstract  java.lang.String getResponseHeader(java.lang.String name)
           
abstract  java.util.Map<java.lang.String,java.util.List<java.lang.String>> getResponseHeaderFields()
           
 int getStatusCode()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HttpResponse

public HttpResponse()
Method Detail

getStatusCode

public final int getStatusCode()

getResponseHeader

public abstract java.lang.String getResponseHeader(java.lang.String name)

getResponseHeaderFields

public abstract java.util.Map<java.lang.String,java.util.List<java.lang.String>> getResponseHeaderFields()

asStream

public final java.io.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 final java.lang.String asString()
                                throws TwitterException
Returns the response body as string.
Disconnects the internal HttpURLConnection silently.

Returns:
response body
Throws:
TwitterException

asDocument

public final org.w3c.dom.Document asDocument()
                                      throws TwitterException
Returns the response body as org.w3c.dom.Document.
Disconnects the internal HttpURLConnection silently.

Returns:
response body as org.w3c.dom.Document
Throws:
TwitterException

asJSONObject

public final 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 final 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 final java.io.InputStreamReader asReader()

disconnect

public abstract void disconnect()
                         throws java.io.IOException
Throws:
java.io.IOException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2011. All Rights Reserved.