public class DigestingEntityConsumer<T> extends Object implements AsyncEntityConsumer<T>
AsyncEntityConsumer decorator that calculates a digest hash from
 the data stream content and keeps the list of trailers received with
 the data stream.| Constructor and Description | 
|---|
| DigestingEntityConsumer(String algo,
                       AsyncEntityConsumer<T> wrapped) | 
| Modifier and Type | Method and Description | 
|---|---|
| void | consume(ByteBuffer src)Triggered to pass incoming data to the data consumer. | 
| 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  nullif the entity is still being received. | 
| byte[] | getDigest()Returns digest hash. | 
| List<Header> | getTrailers()List of trailers sent with the data stream. | 
| 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 DigestingEntityConsumer(String algo, AsyncEntityConsumer<T> wrapped) throws NoSuchAlgorithmException
NoSuchAlgorithmExceptionpublic void streamStart(EntityDetails entityDetails, FutureCallback<T> resultCallback) throws IOException, HttpException
AsyncEntityConsumerstreamStart in interface AsyncEntityConsumer<T>entityDetails - the details of the incoming message entity.resultCallback - the result callback.IOExceptionHttpExceptionpublic void updateCapacity(CapacityChannel capacityChannel) throws IOException
AsyncDataConsumerupdateCapacity in interface AsyncDataConsumercapacityChannel - the channel for capacity updates.IOExceptionpublic void consume(ByteBuffer src) throws IOException
AsyncDataConsumerconsume in interface AsyncDataConsumersrc - data source.IOExceptionpublic void streamEnd(List<? extends Header> trailers) throws HttpException, IOException
AsyncDataConsumerstreamEnd in interface AsyncDataConsumertrailers - data stream trailers.HttpExceptionIOExceptionpublic void failed(Exception cause)
AsyncEntityConsumerfailed in interface AsyncEntityConsumer<T>cause - the cause of the failure.public T getContent()
AsyncEntityConsumernull
 if the entity is still being received.getContent in interface AsyncEntityConsumer<T>public void releaseResources()
releaseResources in interface ResourceHolderpublic List<Header> getTrailers()
public byte[] getDigest()
Copyright © 2005–2022 The Apache Software Foundation. All rights reserved.