Interface AsyncDataConsumer

All Superinterfaces:
ResourceHolder
All Known Subinterfaces:
AsyncClientExchangeHandler, AsyncDataExchangeHandler, AsyncEntityConsumer<T>, AsyncPushConsumer, AsyncRequestConsumer<T>, AsyncResponseConsumer<T>, AsyncServerExchangeHandler
All Known Implementing Classes:
AbstractAsyncPushHandler, AbstractAsyncRequesterConsumer, AbstractAsyncResponseConsumer, AbstractBinAsyncEntityConsumer, AbstractBinDataConsumer, AbstractCharAsyncEntityConsumer, AbstractCharDataConsumer, AbstractClassicEntityConsumer, AbstractClassicServerExchangeHandler, AbstractServerExchangeHandler, BasicAsyncEntityConsumer, BasicAsyncServerExpectationDecorator, BasicClientExchangeHandler, BasicRequestConsumer, BasicResponseConsumer, BasicServerExchangeHandler, DigestingEntityConsumer, DiscardingEntityConsumer, ImmediateResponseExchangeHandler, NoopAsyncPushHandler, NoopEntityConsumer, ReactiveDataConsumer, ReactiveResponseConsumer, ReactiveServerExchangeHandler, StringAsyncEntityConsumer

public interface AsyncDataConsumer extends ResourceHolder
Abstract asynchronous data consumer.
Since:
5.0
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Triggered to pass incoming data to the data consumer.
    void
    streamEnd(List<? extends Header> trailers)
    Triggered to signal termination of the data stream.
    void
    Triggered to signal ability of the underlying data stream to receive data capacity update.

    Methods inherited from interface org.apache.hc.core5.http.nio.ResourceHolder

    releaseResources
  • Method Details

    • updateCapacity

      void updateCapacity(CapacityChannel capacityChannel) throws IOException
      Triggered to signal ability of the underlying data stream to receive data capacity update. The data consumer can choose to write data immediately inside the call or asynchronously at some later point.
      Parameters:
      capacityChannel - the channel for capacity updates.
      Throws:
      IOException
    • consume

      void consume(ByteBuffer src) throws IOException
      Triggered to pass incoming data to the data consumer. The consumer must consume the entire content of the data buffer. The consumer must stop incrementing its capacity on the capacity channel if it is unable to accept more data. Once the data consumer has handled accumulated data or allocated more intermediate storage it can update its capacity information on the capacity channel.
      Parameters:
      src - data source.
      Throws:
      IOException
    • streamEnd

      void streamEnd(List<? extends Header> trailers) throws HttpException, IOException
      Triggered to signal termination of the data stream.
      Parameters:
      trailers - data stream trailers.
      Throws:
      HttpException
      IOException