T - entity representation.public abstract class AbstractClassicEntityConsumer<T> extends Object implements AsyncEntityConsumer<T>
AsyncEntityConsumer implementation that acts as a compatibility
layer for classic InputStream based interfaces. Blocking input
processing is executed through an Executor.| 构造器和说明 |
|---|
AbstractClassicEntityConsumer(int initialBufferSize,
Executor executor) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
consume(ByteBuffer src)
Triggered to pass incoming data to the data consumer.
|
protected abstract T |
consumeData(ContentType contentType,
InputStream inputStream)
Processes entity data from the given stream.
|
void |
failed(Exception cause)
Triggered to signal a failure in data processing.
|
T |
getContent()
Returns the result of entity processing when it becomes available or
null
if the entity is still being received. |
Exception |
getException() |
void |
releaseResources() |
void |
streamEnd(List<? extends Header> trailers)
Triggered to signal termination of the data stream.
|
void |
streamStart(EntityDetails entityDetails,
FutureCallback<T> resultCallback)
Signals beginning of an incoming request entity stream.
|
void |
updateCapacity(CapacityChannel capacityChannel)
Triggered to signal ability of the underlying data stream to receive
data capacity update.
|
public AbstractClassicEntityConsumer(int initialBufferSize,
Executor executor)
protected abstract T consumeData(ContentType contentType, InputStream inputStream) throws IOException
contentType - the entity content typeinputStream - the input streamIOExceptionpublic final void updateCapacity(CapacityChannel capacityChannel) throws IOException
AsyncDataConsumerupdateCapacity 在接口中 AsyncDataConsumercapacityChannel - the channel for capacity updates.IOExceptionpublic final void streamStart(EntityDetails entityDetails, FutureCallback<T> resultCallback) throws HttpException, IOException
AsyncEntityConsumerstreamStart 在接口中 AsyncEntityConsumer<T>entityDetails - the details of the incoming message entity.resultCallback - the result callback.HttpExceptionIOExceptionpublic final void consume(ByteBuffer src) throws IOException
AsyncDataConsumerconsume 在接口中 AsyncDataConsumersrc - data source.IOExceptionpublic final void streamEnd(List<? extends Header> trailers) throws HttpException, IOException
AsyncDataConsumerstreamEnd 在接口中 AsyncDataConsumertrailers - data stream trailers.HttpExceptionIOExceptionpublic final void failed(Exception cause)
AsyncEntityConsumerfailed 在接口中 AsyncEntityConsumer<T>cause - the cause of the failure.public final Exception getException()
public final T getContent()
AsyncEntityConsumernull
if the entity is still being received.getContent 在接口中 AsyncEntityConsumer<T>public void releaseResources()
releaseResources 在接口中 ResourceHolderCopyright © 2023. All rights reserved.