Class HttpEntityAsyncEntityProducer
- java.lang.Object
-
- org.opensearch.client.transport.httpclient5.internal.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.AsyncEntityProducerTheAsyncEntityProducerimplementation forHttpEntity
-
-
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 intavailable()Returns the number of bytes immediately available for output.voidfailed(java.lang.Exception cause)Triggered to signal a failure in data generation.java.lang.StringgetContentEncoding()Returns content encoding of the entity, if known.longgetContentLength()Returns length of the entity, if known.java.lang.StringgetContentType()Returns content type of the entity, if known.java.util.Set<java.lang.String>getTrailerNames()Preliminary declaration of trailing headers.booleanisChunked()Returns chunked transfer hint for this entity.booleanisRepeatable()Determines whether the producer can consistently produce the same content after invocation ofResourceHolder.releaseResources().voidproduce(org.apache.hc.core5.http.nio.DataStreamChannel channel)Triggered to signal the ability of the underlying data channel to accept more data.voidreleaseResources()Release resources being held
-
-
-
Constructor Detail
-
HttpEntityAsyncEntityProducer
public HttpEntityAsyncEntityProducer(org.apache.hc.core5.http.HttpEntity entity, int bufferSize)Create new async HTTP entity producer- Parameters:
entity- HTTP entitybufferSize- 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 ofResourceHolder.releaseResources().- Specified by:
isRepeatablein interfaceorg.apache.hc.core5.http.nio.AsyncEntityProducer
-
getContentType
public java.lang.String getContentType()
Returns content type of the entity, if known.- Specified by:
getContentTypein interfaceorg.apache.hc.core5.http.EntityDetails
-
getContentLength
public long getContentLength()
Returns length of the entity, if known.- Specified by:
getContentLengthin interfaceorg.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:
availablein interfaceorg.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:
getContentEncodingin interfaceorg.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:
isChunkedin interfaceorg.apache.hc.core5.http.EntityDetails
-
getTrailerNames
public java.util.Set<java.lang.String> getTrailerNames()
Preliminary declaration of trailing headers.- Specified by:
getTrailerNamesin interfaceorg.apache.hc.core5.http.EntityDetails
-
produce
public void produce(org.apache.hc.core5.http.nio.DataStreamChannel channel) throws java.io.IOExceptionTriggered 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:
producein interfaceorg.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:
failedin interfaceorg.apache.hc.core5.http.nio.AsyncEntityProducer- Parameters:
cause- the cause of the failure.
-
releaseResources
public void releaseResources()
Release resources being held- Specified by:
releaseResourcesin interfaceorg.apache.hc.core5.http.nio.ResourceHolder
-
-