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

## Class StringAsyncEntityConsumer

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

- All Implemented Interfaces:
    AsyncDataConsumer, AsyncEntityConsumer<String>, ResourceHolder

      public class StringAsyncEntityConsumer
      extends AbstractCharAsyncEntityConsumer<String>

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

- - ### Field Summary

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

      `DEF_BUF_SIZE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `StringAsyncEntityConsumer()`
    `StringAsyncEntityConsumer(CharCodingConfig charCodingConfig)`
    `StringAsyncEntityConsumer(int capacityIncrement)`
    `StringAsyncEntityConsumer(int bufSize, int capacityIncrement, CharCodingConfig charCodingConfig)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected int` | `capacityIncrement()` Triggered to obtain the capacity increment.
    `protected void` | `data(CharBuffer src, boolean endOfStream)` Triggered to pass incoming data packet to the data consumer.
    `String` | `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.AbstractCharAsyncEntityConsumer

      `completed, failed, getContent, streamStart`

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

      `consume, 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`

- - ### Constructor Detail

    - #### StringAsyncEntityConsumer

          public StringAsyncEntityConsumer(int bufSize,
                                   int capacityIncrement,
                                   CharCodingConfig charCodingConfig)

    - #### StringAsyncEntityConsumer

          public StringAsyncEntityConsumer(int capacityIncrement)

    - #### StringAsyncEntityConsumer

          public StringAsyncEntityConsumer(CharCodingConfig charCodingConfig)

    - #### StringAsyncEntityConsumer

          public StringAsyncEntityConsumer()

  - ### Method Detail

    - #### streamStart

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

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

    - #### capacityIncrement

          protected int capacityIncrement()

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

    - #### data

          protected final void data(CharBuffer src,
                  boolean endOfStream)

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

    - #### generateContent

          public String generateContent()

      Description copied from class: `AbstractCharAsyncEntityConsumer`
      Triggered to generate entity representation.
      Specified by:
        `generateContent` in class `AbstractCharAsyncEntityConsumer<String>`
      Returns:
        the entity content

    - #### releaseResources

          public void releaseResources()

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