Top Description Fields Constructors Methods
org.apache.hc.core5.reactive

public final Class ReactiveEntityProducer

extends Object
implements AsyncEntityProducer
Class Inheritance
All Implemented Interfaces
org.apache.hc.core5.http.nio.AsyncEntityProducer, org.apache.hc.core5.http.EntityDetails, org.apache.hc.core5.http.nio.AsyncDataProducer, org.apache.hc.core5.http.nio.ResourceHolder
Annotations
@Contract
threading:SAFE
Imports
org.apache.hc.core5.annotation.Contract, .ThreadingBehavior, org.apache.hc.core5.http.ContentType, org.apache.hc.core5.http.nio.AsyncEntityProducer, .DataStreamChannel, org.reactivestreams.Publisher, java.io.IOException, java.nio.ByteBuffer, java.util.Set

An AsyncEntityProducer that subscribes to a Publisher instance, as defined by the Reactive Streams specification.
Since
5.0

Field Summary

Modifier and TypeField and Description
private final String
private final long
private final ContentType
private final ReactiveDataProducer

Constructor Summary

AccessConstructor and Description
public
ReactiveEntityProducer(final Publisher<ByteBuffer>
the publisher of the entity stream.
publisher
,
final long
the length of the entity, or -1 if unknown (implies chunked encoding).
contentLength
,
final ContentType
the Content-Type of the entity, or null if none.
contentType
,
final String
the Content-Encoding of the entity, or null if none.
contentEncoding
)

Creates a new ReactiveEntityProducer with the given parameters.

Method Summary

Modifier and TypeMethod and Description
public int
available()

Implements org.apache.hc.core5.http.nio.AsyncDataProducer.available.

Returns the number of bytes immediately available for output.
public void
failed(final Exception
the cause of the failure.
cause
)

Implements org.apache.hc.core5.http.nio.AsyncEntityProducer.failed.

Triggered to signal a failure in data generation.
public String
getContentEncoding()

Implements org.apache.hc.core5.http.EntityDetails.getContentEncoding.

Returns content encoding of the entity, if known.
public long
getContentLength()

Implements org.apache.hc.core5.http.EntityDetails.getContentLength.

Returns length of the entity, if known.
public String
getContentType()

Implements org.apache.hc.core5.http.EntityDetails.getContentType.

Returns content type of the entity, if known.
public Set<String>
getTrailerNames()

Implements org.apache.hc.core5.http.EntityDetails.getTrailerNames.

Preliminary declaration of trailing headers.
public boolean
isChunked()

Implements org.apache.hc.core5.http.EntityDetails.isChunked.

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

Implements org.apache.hc.core5.http.nio.AsyncEntityProducer.isRepeatable.

Determines whether the producer can consistently produce the same content after invocation of ResourceHolder#releaseResources().
public void
produce(final DataStreamChannel
the data channel capable to accepting more data.
channel
)

Implements org.apache.hc.core5.http.nio.AsyncDataProducer.produce.

Triggered to signal the ability of the underlying data channel to accept more data.
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

contentEncodingback to summary
private final String contentEncoding
contentLengthback to summary
private final long contentLength
contentTypeback to summary
private final ContentType contentType
reactiveDataProducerback to summary
private final ReactiveDataProducer reactiveDataProducer

Constructor Detail

ReactiveEntityProducerback to summary
public ReactiveEntityProducer(final Publisher<ByteBuffer> publisher, final long contentLength, final ContentType contentType, final String contentEncoding)

Creates a new ReactiveEntityProducer with the given parameters.

Parameters
publisher:Publisher<ByteBuffer>

the publisher of the entity stream.

contentLength:long

the length of the entity, or -1 if unknown (implies chunked encoding).

contentType:ContentType

the Content-Type of the entity, or null if none.

contentEncoding:String

the Content-Encoding of the entity, or null if none.

Method Detail

availableback to summary
public int available()

Implements org.apache.hc.core5.http.nio.AsyncDataProducer.available.

Doc from org.apache.hc.core5.http.nio.AsyncDataProducer.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.

Returns:int

the number of bytes immediately available for output

Annotations
@Override
failedback to summary
public void failed(final Exception cause)

Implements org.apache.hc.core5.http.nio.AsyncEntityProducer.failed.

Doc from org.apache.hc.core5.http.nio.AsyncEntityProducer.failed.

Triggered to signal a failure in data generation.

Parameters
cause:Exception

the cause of the failure.

Annotations
@Override
getContentEncodingback to summary
public String getContentEncoding()

Implements org.apache.hc.core5.http.EntityDetails.getContentEncoding.

Doc from org.apache.hc.core5.http.EntityDetails.getContentEncoding.

Returns content encoding of the entity, if known.

Annotations
@Override
getContentLengthback to summary
public long getContentLength()

Implements org.apache.hc.core5.http.EntityDetails.getContentLength.

Doc from org.apache.hc.core5.http.EntityDetails.getContentLength.

Returns length of the entity, if known.

Annotations
@Override
getContentTypeback to summary
public String getContentType()

Implements org.apache.hc.core5.http.EntityDetails.getContentType.

Doc from org.apache.hc.core5.http.EntityDetails.getContentType.

Returns content type of the entity, if known.

Annotations
@Override
getTrailerNamesback to summary
public Set<String> getTrailerNames()

Implements org.apache.hc.core5.http.EntityDetails.getTrailerNames.

Doc from org.apache.hc.core5.http.EntityDetails.getTrailerNames.

Preliminary declaration of trailing headers.

Annotations
@Override
isChunkedback to summary
public boolean isChunked()

Implements org.apache.hc.core5.http.EntityDetails.isChunked.

Doc from org.apache.hc.core5.http.EntityDetails.isChunked.

Returns chunked transfer hint for this entity.

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

Annotations
@Override
isRepeatableback to summary
public boolean isRepeatable()

Implements org.apache.hc.core5.http.nio.AsyncEntityProducer.isRepeatable.

Doc from org.apache.hc.core5.http.nio.AsyncEntityProducer.isRepeatable.

Determines whether the producer can consistently produce the same content after invocation of ResourceHolder#releaseResources().

Annotations
@Override
produceback to summary
public void produce(final DataStreamChannel channel) throws IOException

Implements org.apache.hc.core5.http.nio.AsyncDataProducer.produce.

Doc from org.apache.hc.core5.http.nio.AsyncDataProducer.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.

Parameters
channel:DataStreamChannel

the data channel capable to accepting more data.

Annotations
@Override
releaseResourcesback to summary
public void releaseResources()

Implements org.apache.hc.core5.http.nio.ResourceHolder.releaseResources.

Annotations
@Override