java.io.Closeable, java.lang.AutoCloseable, Releasablepublic final class InboundChannelBuffer extends java.lang.Object implements Releasable
release(long) method releases the bytes from the head of the buffer and closes
the pages internally. If more space is needed at the end of the buffer ensureCapacity(long) can
be called and the buffer will expand using the supplier provided.| Modifier and Type | Class | Description |
|---|---|---|
static class |
InboundChannelBuffer.Page |
| Constructor | Description |
|---|---|
InboundChannelBuffer(java.util.function.Supplier<InboundChannelBuffer.Page> pageSupplier) |
| Modifier and Type | Method | Description |
|---|---|---|
void |
close() |
|
void |
ensureCapacity(long requiredCapacity) |
|
long |
getCapacity() |
|
long |
getIndex() |
|
long |
getRemaining() |
|
void |
incrementIndex(long delta) |
|
void |
release(long bytesToRelease) |
This method will release bytes from the head of this buffer.
|
java.nio.ByteBuffer[] |
sliceBuffersFrom(long from) |
This method will return an array of
ByteBuffer representing the bytes from the index passed
through the end of this buffer. |
java.nio.ByteBuffer[] |
sliceBuffersTo(long to) |
This method will return an array of
ByteBuffer representing the bytes from the beginning of
this buffer up through the index argument that was passed. |
public InboundChannelBuffer(java.util.function.Supplier<InboundChannelBuffer.Page> pageSupplier)
public void close()
close in interface java.lang.AutoCloseableclose in interface java.io.Closeableclose in interface Releasablepublic void ensureCapacity(long requiredCapacity)
public void release(long bytesToRelease)
bytesToRelease - number of bytes to droppublic java.nio.ByteBuffer[] sliceBuffersTo(long to)
ByteBuffer representing the bytes from the beginning of
this buffer up through the index argument that was passed. The buffers will be duplicates of the
internal buffers, so any modifications to the markers Buffer.position(),
Buffer.limit(), etc will not modify the this class.to - the index to slice up topublic java.nio.ByteBuffer[] sliceBuffersFrom(long from)
ByteBuffer representing the bytes from the index passed
through the end of this buffer. The buffers will be duplicates of the internal buffers, so any
modifications to the markers Buffer.position(), Buffer.limit(), etc will not
modify the this class.from - the index to slice frompublic void incrementIndex(long delta)
public long getIndex()
public long getCapacity()
public long getRemaining()