Class HttpEntityAsyncEntityProducer

java.lang.Object
org.opensearch.client.nio.HttpEntityAsyncEntityProducer
All Implemented Interfaces:
org.apache.hc.core5.http.EntityDetails, org.apache.hc.core5.http.nio.AsyncDataProducer, org.apache.hc.core5.http.nio.AsyncEntityProducer, org.apache.hc.core5.http.nio.ResourceHolder

public class HttpEntityAsyncEntityProducer extends Object implements org.apache.hc.core5.http.nio.AsyncEntityProducer
The AsyncEntityProducer implementation for HttpEntity
  • Constructor Summary

    Constructors
    Constructor
    Description
    HttpEntityAsyncEntityProducer(org.apache.hc.core5.http.HttpEntity entity)
    Create new async HTTP entity producer with default buffer size (8192 bytes)
    HttpEntityAsyncEntityProducer(org.apache.hc.core5.http.HttpEntity entity, int bufferSize)
    Create new async HTTP entity producer
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the number of bytes immediately available for output.
    void
    Triggered to signal a failure in data generation.
    Returns content encoding of the entity, if known.
    long
    Returns length of the entity, if known.
    Returns content type of the entity, if known.
    Preliminary declaration of trailing headers.
    boolean
    Returns chunked transfer hint for this entity.
    boolean
    Determines whether the producer can consistently produce the same content after invocation of ResourceHolder.releaseResources().
    void
    produce(org.apache.hc.core5.http.nio.DataStreamChannel channel)
    Triggered to signal the ability of the underlying data channel to accept more data.
    void
    Release resources being held

    Methods inherited from class java.lang.Object

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

    • HttpEntityAsyncEntityProducer

      public HttpEntityAsyncEntityProducer(org.apache.hc.core5.http.HttpEntity entity, int bufferSize)
      Create new async HTTP entity producer
      Parameters:
      entity - HTTP entity
      bufferSize - buffer size
    • HttpEntityAsyncEntityProducer

      public HttpEntityAsyncEntityProducer(org.apache.hc.core5.http.HttpEntity entity)
      Create new async HTTP entity producer with default buffer size (8192 bytes)
      Parameters:
      entity - HTTP entity
  • Method Details

    • isRepeatable

      public boolean isRepeatable()
      Determines whether the producer can consistently produce the same content after invocation of ResourceHolder.releaseResources().
      Specified by:
      isRepeatable in interface org.apache.hc.core5.http.nio.AsyncEntityProducer
    • getContentType

      public String getContentType()
      Returns content type of the entity, if known.
      Specified by:
      getContentType in interface org.apache.hc.core5.http.EntityDetails
    • getContentLength

      public long getContentLength()
      Returns length of the entity, if known.
      Specified by:
      getContentLength in interface org.apache.hc.core5.http.EntityDetails
    • available

      public int available()
      Returns the number of bytes immediately available for output. This method can be used as a hint to control output events of the underlying I/O session.
      Specified by:
      available in interface org.apache.hc.core5.http.nio.AsyncDataProducer
      Returns:
      the number of bytes immediately available for output
    • getContentEncoding

      public String getContentEncoding()
      Returns content encoding of the entity, if known.
      Specified by:
      getContentEncoding in interface org.apache.hc.core5.http.EntityDetails
    • isChunked

      public boolean isChunked()
      Returns chunked transfer hint for this entity.

      The behavior of wrapping entities is implementation dependent, but should respect the primary purpose.

      Specified by:
      isChunked in interface org.apache.hc.core5.http.EntityDetails
    • getTrailerNames

      public Set<String> getTrailerNames()
      Preliminary declaration of trailing headers.
      Specified by:
      getTrailerNames in interface org.apache.hc.core5.http.EntityDetails
    • produce

      public void produce(org.apache.hc.core5.http.nio.DataStreamChannel channel) throws IOException
      Triggered to signal the ability of the underlying data channel to accept more data. The data producer can choose to write data immediately inside the call or asynchronously at some later point.
      Specified by:
      produce in interface org.apache.hc.core5.http.nio.AsyncDataProducer
      Parameters:
      channel - the data channel capable to accepting more data.
      Throws:
      IOException
    • failed

      public void failed(Exception cause)
      Triggered to signal a failure in data generation.
      Specified by:
      failed in interface org.apache.hc.core5.http.nio.AsyncEntityProducer
      Parameters:
      cause - the cause of the failure.
    • releaseResources

      public void releaseResources()
      Release resources being held
      Specified by:
      releaseResources in interface org.apache.hc.core5.http.nio.ResourceHolder