Buffer and consumers take bytes in
arbitrary lengths. This allows producers to add lots of small buffers and the consumer to take all the bytes out in a
single buffer. Conversely, the producer may add larger buffers and the consumer could take the bytes in many small
buffers.
Bytes are added and removed with promises. If the last byte of a buffer added with a promise is removed then
that promise will complete when the promise passed to remove completes.
This functionality is useful for aggregating or partitioning writes into fixed size buffers for framing protocols such as HTTP2.
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected Buffer | compose(BufferAllocator alloc, Buffer cumulation, Buffer next)
Implements abstract io. current + next.
|
| public void | releaseAndFailAll(Throwable cause)
Release all buffers in the queue and complete all listeners and promises. |
| public Buffer | Returns: aBuffer composed of the enqueued buffers.the maximum number of readable bytes in the returned bytes, Promise<Void> Buffer, if bytes is greater
than readableBytes() then a buffer of length readableBytes() is returned.used to aggregate the promises and listeners for the constituent buffers. aggregatePromise)Remove a |
| protected Buffer | removeEmptyValue()
Implements abstract io. remove(BufferAllocator, int, Promise) is called but the queue is empty.
|
| channel | back to summary |
|---|---|
| private final Channel channel | |
| CoalescingBufferQueue | back to summary |
|---|---|
| public CoalescingBufferQueue(Channel channel) | |
| CoalescingBufferQueue | back to summary |
|---|---|
| public CoalescingBufferQueue(Channel channel, int initSize) | |
| compose | back to summary |
|---|---|
| protected Buffer compose(BufferAllocator alloc, Buffer cumulation, Buffer next) Implements abstract io. Doc from io. Calculate the result of
| |
| releaseAndFailAll | back to summary |
|---|---|
| public void releaseAndFailAll(Throwable cause) Release all buffers in the queue and complete all listeners and promises. | |
| remove | back to summary |
|---|---|
| public Buffer remove(int bytes, Promise<Void> aggregatePromise) Remove a
| |
| removeEmptyValue | back to summary |
|---|---|
| protected Buffer removeEmptyValue() Implements abstract io. Doc from io. The value to return when | |