Package com.ning.http.client
Class HttpResponseBodyPart
java.lang.Object
com.ning.http.client.HttpResponseBodyPart
- Direct Known Subclasses:
GrizzlyResponseBodyPart
A callback class used when an HTTP response body is received.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract ByteBufferReturn aByteBufferthat wraps the actual bytes read from the response's chunk.abstract byte[]Return the response body's part bytes received.booleanisLast()Return true if this is the last part.booleanReturn true of the underlying connection will be closed once the response has been fully processed.abstract intlength()Return length of this part in bytes.voidClose the underlying connection once the processing has completed.abstract intwriteTo(OutputStream outputStream) Write the available bytes to theOutputStream
-
Constructor Details
-
HttpResponseBodyPart
public HttpResponseBodyPart(boolean last)
-
-
Method Details
-
markUnderlyingConnectionAsToBeClosed
public void markUnderlyingConnectionAsToBeClosed()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. -
isUnderlyingConnectionToBeClosed
public boolean isUnderlyingConnectionToBeClosed()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.
-
isLast
public boolean isLast()Return true if this is the last part.- Returns:
- true if this is the last part.
-
length
public abstract int length()Return length of this part in bytes. -
getBodyPartBytes
public abstract byte[] getBodyPartBytes()Return the response body's part bytes received.- Returns:
- the response body's part bytes received.
-
writeTo
Write the available bytes to theOutputStream- Parameters:
outputStream-- Returns:
- The number of bytes written
- Throws:
IOException
-
getBodyByteBuffer
Return aByteBufferthat wraps the actual bytes read from the response's chunk. TheByteBuffercapacity is equal to the number of bytes available.- Returns:
ByteBuffer
-