com.ning.http.client
Class HttpResponseBodyPart

java.lang.Object
  extended by com.ning.http.client.HttpContent
      extended by com.ning.http.client.HttpResponseBodyPart
Direct Known Subclasses:
ApacheResponseBodyPart, GrizzlyResponseBodyPart, ResponseBodyPart, ResponseBodyPart

public abstract class HttpResponseBodyPart
extends HttpContent

A callback class used when an HTTP response body is received.


Field Summary
 
Fields inherited from class com.ning.http.client.HttpContent
provider, uri
 
Constructor Summary
HttpResponseBodyPart(URI uri, AsyncHttpProvider provider)
           
 
Method Summary
abstract  boolean closeUnderlyingConnection()
          Return true of the underlying connection will be closed once the response has been fully processed.
abstract  ByteBuffer getBodyByteBuffer()
          Return a ByteBuffer that wraps the actual bytes read from the response's chunk.
abstract  byte[] getBodyPartBytes()
          Return the response body's part bytes received.
abstract  boolean isLast()
          Return true if this is the last part.
abstract  int length()
           
abstract  void markUnderlyingConnectionAsClosed()
          Close the underlying connection once the processing has completed.
abstract  int writeTo(OutputStream outputStream)
          Write the available bytes to the OutputStream
 
Methods inherited from class com.ning.http.client.HttpContent
getUrl, provider
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpResponseBodyPart

public HttpResponseBodyPart(URI uri,
                            AsyncHttpProvider provider)
Method Detail

getBodyPartBytes

public abstract byte[] getBodyPartBytes()
Return the response body's part bytes received.

Returns:
the response body's part bytes received.

writeTo

public abstract int writeTo(OutputStream outputStream)
                     throws IOException
Write the available bytes to the OutputStream

Parameters:
outputStream -
Returns:
The number of bytes written
Throws:
IOException

getBodyByteBuffer

public abstract ByteBuffer getBodyByteBuffer()
Return a ByteBuffer that wraps the actual bytes read from the response's chunk. The ByteBuffer capacity is equal to the number of bytes available.

Returns:
ByteBuffer

isLast

public abstract boolean isLast()
Return true if this is the last part.

Returns:
true if this is the last part.

markUnderlyingConnectionAsClosed

public abstract void markUnderlyingConnectionAsClosed()
Close the underlying connection once the processing has completed. Invoking that method means the underlying TCP connection will be closed as soon as the processing of the response is completed. That means the underlying connection will never get pooled.


closeUnderlyingConnection

public abstract boolean closeUnderlyingConnection()
Return true of the underlying connection will be closed once the response has been fully processed.

Returns:
true of the underlying connection will be closed once the response has been fully processed.

length

public abstract int length()


Copyright © 2014. All Rights Reserved.