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

## Class AbstractCharAsyncEntityConsumer<T>

- java.lang.Object
- - org.apache.hc.core5.http.nio.entity.AbstractCharDataConsumer
  - - org.apache.hc.core5.http.nio.entity.AbstractCharAsyncEntityConsumer<T>

- Type Parameters:
    `T` - entity representation.
  All Implemented Interfaces:
    AsyncDataConsumer, AsyncEntityConsumer<T>, ResourceHolder
  Direct Known Subclasses:
    StringAsyncEntityConsumer

      public abstract class AbstractCharAsyncEntityConsumer<T>
      extends AbstractCharDataConsumer
      implements AsyncEntityConsumer<T>

  Abstract text entity content consumer.
  Since:
    5.0

- - ### Field Summary

    - ### Fields inherited from class org.apache.hc.core5.http.nio.entity.AbstractCharDataConsumer

      `DEF_BUF_SIZE`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `` | `AbstractCharAsyncEntityConsumer()`
    `protected` | `AbstractCharAsyncEntityConsumer(int bufSize, CharCodingConfig charCodingConfig)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `completed()` Triggered to signal completion of data processing.
    `void` | `failed(Exception cause)` Triggered to signal a failure in data processing.
    `protected abstract T` | `generateContent()` Triggered to generate entity representation.
    `T` | `getContent()` Returns the result of entity processing when it becomes available or `null` if the entity is still being received.
    `protected abstract void` | `streamStart(ContentType contentType)` Triggered to signal beginning of entity content stream.
    `void` | `streamStart(EntityDetails entityDetails, FutureCallback<T> resultCallback)` Signals beginning of an incoming request entity stream.

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

      `capacityIncrement, consume, data, setCharset, 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`

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

      `releaseResources`

- - ### Constructor Detail

    - #### AbstractCharAsyncEntityConsumer

          protected AbstractCharAsyncEntityConsumer(int bufSize,
                                                    CharCodingConfig charCodingConfig)

    - #### AbstractCharAsyncEntityConsumer

          public AbstractCharAsyncEntityConsumer()

  - ### Method Detail

    - #### streamStart

          protected abstract void streamStart(ContentType contentType)
                                       throws HttpException,
                                              IOException

      Triggered to signal beginning of entity content stream.
      Parameters:
        `contentType` - the entity content type
      Throws:
        `HttpException`
        `IOException`

    - #### generateContent

          protected abstract T generateContent()
                                        throws IOException

      Triggered to generate entity representation.
      Returns:
        the entity content
      Throws:
        `IOException`

    - #### streamStart

          public final void streamStart(EntityDetails entityDetails,
                                        FutureCallback<T> resultCallback)
                                 throws IOException,
                                        HttpException

      Description copied from interface: `AsyncEntityConsumer`
      Signals beginning of an incoming request entity stream.
      Specified by:
        `streamStart` in interface `AsyncEntityConsumer<T>`
      Parameters:
        `entityDetails` - the details of the incoming message entity.
        `resultCallback` - the result callback.
      Throws:
        `IOException`
        `HttpException`

    - #### completed

          protected final void completed()
                                  throws IOException

      Description copied from class: `AbstractCharDataConsumer`
      Triggered to signal completion of data processing.
      Specified by:
        `completed` in class `AbstractCharDataConsumer`
      Throws:
        `IOException`

    - #### failed

          public final void failed(Exception cause)

      Description copied from interface: `AsyncEntityConsumer`
      Triggered to signal a failure in data processing.
      Specified by:
        `failed` in interface `AsyncEntityConsumer<T>`
      Parameters:
        `cause` - the cause of the failure.

    - #### getContent

          public final T getContent()

      Description copied from interface: `AsyncEntityConsumer`
      Returns the result of entity processing when it becomes available or `null` if the entity is still being received.
      Specified by:
        `getContent` in interface `AsyncEntityConsumer<T>`
      Returns:
        the response processing result.

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