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
ConstructorsConstructorDescriptionHttpEntityAsyncEntityProducer(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 TypeMethodDescriptionintReturns the number of bytes immediately available for output.voidTriggered to signal a failure in data generation.Returns content encoding of the entity, if known.longReturns length of the entity, if known.Returns content type of the entity, if known.Preliminary declaration of trailing headers.booleanReturns chunked transfer hint for this entity.booleanDetermines 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.voidRelease resources being held
-
Constructor Details
-
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 Details
-
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
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
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
-
produce
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:
producein interfaceorg.apache.hc.core5.http.nio.AsyncDataProducer- Parameters:
channel- the data channel capable to accepting more data.- Throws:
IOException
-
failed
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
-