org.apache.hc.core5.http.nio.entity

## Class BasicAsyncEntityConsumer

- java.lang.Object
- - org.apache.hc.core5.http.nio.entity.AbstractBinDataConsumer
  - - org.apache.hc.core5.http.nio.entity.AbstractBinAsyncEntityConsumer<byte[]>
    - - org.apache.hc.core5.http.nio.entity.BasicAsyncEntityConsumer

- All Implemented Interfaces:
    AsyncDataConsumer, AsyncEntityConsumer<byte[]>, ResourceHolder

      public class BasicAsyncEntityConsumer
      extends AbstractBinAsyncEntityConsumer<byte[]>

  Basic `AsyncEntityConsumer` implementation that processes the data stream content into a byte array.
  Since:
    5.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BasicAsyncEntityConsumer()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected int` | `capacityIncrement()` Triggered to obtain the capacity increment.
    `protected void` | `data(ByteBuffer src, boolean endOfStream)` Triggered to pass incoming data packet to the data consumer.
    `protected byte[]` | `generateContent()` Triggered to generate entity representation.
    `void` | `releaseResources()`
    `protected void` | `streamStart(ContentType contentType)` Triggered to signal beginning of entity content stream.

    - ### Methods inherited from class org.apache.hc.core5.http.nio.entity.AbstractBinAsyncEntityConsumer

      `completed, failed, getContent, streamStart`

    - ### Methods inherited from class org.apache.hc.core5.http.nio.entity.AbstractBinDataConsumer

      `consume, streamEnd, updateCapacity`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.apache.hc.core5.http.nio.AsyncDataConsumer

      `consume, streamEnd, updateCapacity`

- - ### Constructor Detail

    - #### BasicAsyncEntityConsumer

          public BasicAsyncEntityConsumer()

  - ### Method Detail

    - #### streamStart

          protected void streamStart(ContentType contentType)
                              throws HttpException,
                                     IOException

      Description copied from class: `AbstractBinAsyncEntityConsumer`
      Triggered to signal beginning of entity content stream.
      Specified by:
        `streamStart` in class `AbstractBinAsyncEntityConsumer<byte[]>`
      Parameters:
        `contentType` - the entity content type
      Throws:
        `HttpException`
        `IOException`

    - #### capacityIncrement

          protected int capacityIncrement()

      Description copied from class: `AbstractBinDataConsumer`
      Triggered to obtain the capacity increment.
      Specified by:
        `capacityIncrement` in class `AbstractBinDataConsumer`
      Returns:
        the number of bytes this consumer is prepared to process.

    - #### data

          protected void data(ByteBuffer src,
                              boolean endOfStream)
                       throws IOException

      Description copied from class: `AbstractBinDataConsumer`
      Triggered to pass incoming data packet to the data consumer.
      Specified by:
        `data` in class `AbstractBinDataConsumer`
      Parameters:
        `src` - the data packet.
        `endOfStream` - flag indicating whether this data packet is the last in the data stream.
      Throws:
        `IOException`

    - #### generateContent

          protected byte[] generateContent()
                                    throws IOException

      Description copied from class: `AbstractBinAsyncEntityConsumer`
      Triggered to generate entity representation.
      Specified by:
        `generateContent` in class `AbstractBinAsyncEntityConsumer<byte[]>`
      Returns:
        the entity content
      Throws:
        `IOException`

    - #### releaseResources

          public void releaseResources()

Copyright © 2005–2022 The Apache Software Foundation. All rights reserved.