public class

ResponseBodyPart

extends HttpResponseBodyPart
java.lang.Object
   ↳ com.ning.http.client.HttpContent
     ↳ com.ning.http.client.HttpResponseBodyPart
       ↳ com.ning.http.client.providers.netty.ResponseBodyPart

Class Overview

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

Summary

[Expand]
Inherited Fields
From class com.ning.http.client.HttpContent
Public Constructors
ResponseBodyPart(URI uri, HttpResponse response, AsyncHttpProvider provider, boolean last)
ResponseBodyPart(URI uri, HttpResponse response, AsyncHttpProvider provider, HttpChunk chunk, boolean last)
Public Methods
boolean closeUnderlyingConnection()
Return true of the underlying connection will be closed once the response has been fully processed.
ByteBuffer getBodyByteBuffer()
Return a ByteBuffer that wraps the actual bytes read from the response's chunk.
byte[] getBodyPartBytes()
Return the response body's part bytes received.
boolean isLast()
Return true if this is the last part.
void markUnderlyingConnectionAsClosed()
Close the underlying connection once the processing has completed.
int writeTo(OutputStream outputStream)
Write the available bytes to the java.io.OutputStream
Protected Methods
HttpChunk chunk()
[Expand]
Inherited Methods
From class com.ning.http.client.HttpResponseBodyPart
From class com.ning.http.client.HttpContent
From class java.lang.Object

Public Constructors

public ResponseBodyPart (URI uri, HttpResponse response, AsyncHttpProvider provider, boolean last)

public ResponseBodyPart (URI uri, HttpResponse response, AsyncHttpProvider provider, HttpChunk chunk, boolean last)

Public Methods

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

public 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

public byte[] getBodyPartBytes ()

Return the response body's part bytes received.

Returns
  • the response body's part bytes received.

public boolean isLast ()

Return true if this is the last part.

Returns
  • true if this is the last part.

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

public int writeTo (OutputStream outputStream)

Write the available bytes to the java.io.OutputStream

Returns
  • The number of bytes written
Throws
IOException

Protected Methods

protected HttpChunk chunk ()