A Content. backed by another Content..
Any content written to this Content. is buffered,
then written to the delegate using
Content..
| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private ByteBufferAggregator | |
| private final ByteBufferPool | |
| private final Content. | |
| private final boolean | |
| private boolean | |
| private final BufferedContentSink. | |
| private boolean | |
| private final int | |
| private final int | |
| public static final ByteBuffer | FLUSH_BUFFER
An empty |
| private static final Logger | |
| private static final int |
| Access | Constructor and Description |
|---|---|
| public | BufferedContentSink(Content.
|
| Modifier and Type | Method and Description |
|---|---|
| private void | aggregateAndFlush(boolean last, ByteBuffer currentBuffer, Callback callback)
Aggregates the given buffer, flushing the aggregated buffer if necessary. |
| public void | |
| private void | flush(boolean last, ByteBuffer currentBuffer, Callback callback)
Flushes the aggregated buffer if something was aggregated, then flushes the given buffer, bypassing the aggregator. |
| public void | write(boolean
whether the ByteBuffer is the last to write last, ByteBuffer the ByteBuffer to write byteBuffer, Callback the callback to notify when the write operation is complete callback)Implements org. Writes the given |
| _aggregator | back to summary |
|---|---|
| private ByteBufferAggregator _aggregator | |
| _bufferPool | back to summary |
|---|---|
| private final ByteBufferPool _bufferPool | |
| _delegate | back to summary |
|---|---|
| private final Content. | |
| _direct | back to summary |
|---|---|
| private final boolean _direct | |
| _firstWrite | back to summary |
|---|---|
| private boolean _firstWrite | |
| _flusher | back to summary |
|---|---|
| private final BufferedContentSink. | |
| _lastWritten | back to summary |
|---|---|
| private boolean _lastWritten | |
| _maxAggregationSize | back to summary |
|---|---|
| private final int _maxAggregationSize | |
| _maxBufferSize | back to summary |
|---|---|
| private final int _maxBufferSize | |
| FLUSH_BUFFER | back to summary |
|---|---|
| public static final ByteBuffer FLUSH_BUFFER An empty | |
| LOG | back to summary |
|---|---|
| private static final Logger LOG | |
| START_BUFFER_SIZE | back to summary |
|---|---|
| private static final int START_BUFFER_SIZE | |
| BufferedContentSink | back to summary |
|---|---|
| public BufferedContentSink(Content. | |
| aggregateAndFlush | back to summary |
|---|---|
| private void aggregateAndFlush(boolean last, ByteBuffer currentBuffer, Callback callback) Aggregates the given buffer, flushing the aggregated buffer if necessary. | |
| flush | back to summary |
|---|---|
| public void flush(Callback callback) Flush the buffered content.
| |
| flush | back to summary |
|---|---|
| private void flush(boolean last, ByteBuffer currentBuffer, Callback callback) Flushes the aggregated buffer if something was aggregated, then flushes the given buffer, bypassing the aggregator. | |
| write | back to summary |
|---|---|
| public void write(boolean last, ByteBuffer byteBuffer, Callback callback) Implements org. Doc from org. Writes the given Implementations guarantee that calls to this method are safely reentrant so that
stack overflows are avoided in the case of mutual recursion between the execution of
the
| |
| Modifier and Type | Field and Description |
|---|---|
| private ByteBuffer | |
| private Callback | |
| private boolean | |
| private boolean | |
| private final Content. | |
| private static final ByteBuffer |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv void | |
| pack-priv void | |
| protected void | onCompleteFailure(Throwable
the throwable to indicate cause of failure cause)Overrides org. |
| protected IteratingCallback. | process()
Implements abstract org. iterate() to process the asynchronous sub-task.
|
| public void | succeeded()
Overrides org. Overrides default org. |
| _buffer | back to summary |
|---|---|
| private ByteBuffer _buffer | |
| _callback | back to summary |
|---|---|
| private Callback _callback | |
| _last | back to summary |
|---|---|
| private boolean _last | |
| _lastWritten | back to summary |
|---|---|
| private boolean _lastWritten | |
| _sink | back to summary |
|---|---|
| private final Content. | |
| COMPLETE_CALLBACK | back to summary |
|---|---|
| private static final ByteBuffer COMPLETE_CALLBACK | |
| Flusher | back to summary |
|---|---|
| pack-priv Flusher(Content. | |
| offer | back to summary |
|---|---|
| pack-priv void offer(Callback callback) | |
| offer | back to summary |
|---|---|
| pack-priv void offer(boolean last, ByteBuffer byteBuffer, Callback callback) | |
| onCompleteFailure | back to summary |
|---|---|
| protected void onCompleteFailure(Throwable cause) Overrides org. Doc from org. Invoked when the overall task has completed with a failure. | |
| process | back to summary |
|---|---|
| protected IteratingCallback. Implements abstract org. Doc from org. Method called by Implementations must initiate the asynchronous execution of the sub-task (if any) and return an appropriate action:
| |
| succeeded | back to summary |
|---|---|
| public void succeeded() Overrides org. Overrides default org. Doc from org. Method to invoke when the asynchronous sub-task succeeds.
Subclasses that override this method must always remember
to call
| |