Class AsyncByteConsumer<T>

java.lang.Object
org.apache.http.nio.protocol.AbstractAsyncResponseConsumer<T>
org.apache.http.nio.client.methods.AsyncByteConsumer<T>
All Implemented Interfaces:
Closeable, AutoCloseable, org.apache.http.concurrent.Cancellable, org.apache.http.nio.protocol.HttpAsyncResponseConsumer<T>

public abstract class AsyncByteConsumer<T> extends org.apache.http.nio.protocol.AbstractAsyncResponseConsumer<T>
HttpAsyncResponseConsumer implementation that provides convenience methods for processing of binary content entities enclosed in an HTTP response.
Since:
4.0
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final ByteBuffer
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    AsyncByteConsumer(int bufSize)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected abstract void
    onByteReceived(ByteBuffer buf, org.apache.http.nio.IOControl ioctrl)
    Invoked to process a chunk of content.
    protected final void
    onContentReceived(org.apache.http.nio.ContentDecoder decoder, org.apache.http.nio.IOControl ioctrl)
     
    protected final void
    onEntityEnclosed(org.apache.http.HttpEntity entity, org.apache.http.entity.ContentType contentType)
     
    protected void
     

    Methods inherited from class org.apache.http.nio.protocol.AbstractAsyncResponseConsumer

    buildResult, cancel, close, consumeContent, failed, getContentType, getException, getResult, isDone, onClose, onResponseReceived, responseCompleted, responseReceived

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • AsyncByteConsumer

      public AsyncByteConsumer(int bufSize)
    • AsyncByteConsumer

      public AsyncByteConsumer()
  • Method Details

    • onByteReceived

      protected abstract void onByteReceived(ByteBuffer buf, org.apache.http.nio.IOControl ioctrl) throws IOException
      Invoked to process a chunk of content. The IOControl interface can be used to suspend input events if the consumer is temporarily unable to consume more content.
      Parameters:
      buf - chunk of content.
      ioctrl - I/O control of the underlying connection.
      Throws:
      IOException - in case of an I/O error
    • onEntityEnclosed

      protected final void onEntityEnclosed(org.apache.http.HttpEntity entity, org.apache.http.entity.ContentType contentType) throws IOException
      Specified by:
      onEntityEnclosed in class org.apache.http.nio.protocol.AbstractAsyncResponseConsumer<T>
      Throws:
      IOException
    • onContentReceived

      protected final void onContentReceived(org.apache.http.nio.ContentDecoder decoder, org.apache.http.nio.IOControl ioctrl) throws IOException
      Specified by:
      onContentReceived in class org.apache.http.nio.protocol.AbstractAsyncResponseConsumer<T>
      Throws:
      IOException
    • releaseResources

      protected void releaseResources()
      Specified by:
      releaseResources in class org.apache.http.nio.protocol.AbstractAsyncResponseConsumer<T>