Class 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 java.lang.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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int available()
      Returns the number of bytes immediately available for output.
      void failed​(java.lang.Exception cause)
      Triggered to signal a failure in data generation.
      java.lang.String getContentEncoding()
      Returns content encoding of the entity, if known.
      long getContentLength()
      Returns length of the entity, if known.
      java.lang.String getContentType()
      Returns content type of the entity, if known.
      java.util.Set<java.lang.String> getTrailerNames()
      Preliminary declaration of trailing headers.
      boolean isChunked()
      Returns chunked transfer hint for this entity.
      boolean isRepeatable()
      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 releaseResources()
      Release resources being held
      • Methods inherited from class java.lang.Object

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

      • 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 Detail

      • 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 java.lang.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 java.lang.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 java.util.Set<java.lang.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 java.io.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:
        java.io.IOException
      • failed

        public void failed​(java.lang.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