A pooled ByteBuffer which maintains a reference count that is
incremented with retain() and decremented with release().
The ByteBuffer is released to a ByteBufferPool
when release() is called one more time than retain();
in such case, the call to release() returns true.
A RetainableByteBuffer can either be:
isRetained() returns false
and calling release() throws IllegalStateExceptionisRetained()
returns false and calling release() returns trueisRetained()
returns true and calling release() returns false| Modifier and Type | Class and Description |
|---|---|
| public static class | RetainableByteBuffer.Wrapper
A wrapper for |
| Modifier and Type | Field and Description |
|---|---|
| public static final RetainableByteBuffer | EMPTY
A Zero-capacity, non-retainable |
| Modifier and Type | Method and Description |
|---|---|
| public default int | |
| public default void | |
| public ByteBuffer | |
| public default boolean | |
| public default boolean | |
| public boolean | |
| public default int | |
| public static RetainableByteBuffer | Returns: a non-retainableRetainableByteBufferthe byteBuffer)ByteBuffer to wrapReturns a non-retainable |
| public static RetainableByteBuffer | Returns: aRetainableByteBufferthe byteBuffer, Retainable ByteBuffer to wrapthe associated retainable)Retainable.Returns a |
| EMPTY | back to summary |
|---|---|
| public static final RetainableByteBuffer EMPTY A Zero-capacity, non-retainable | |
| capacity | back to summary |
|---|---|
public default int capacity()
| |
| clear | back to summary |
|---|---|
public default void clear()
| |
| getByteBuffer | back to summary |
|---|---|
| public ByteBuffer getByteBuffer() Get the wrapped, not
| |
| hasRemaining | back to summary |
|---|---|
public default boolean hasRemaining()
| |
| isDirect | back to summary |
|---|---|
public default boolean isDirect()
| |
| isRetained | back to summary |
|---|---|
public boolean isRetained()
| |
| remaining | back to summary |
|---|---|
public default int remaining()
| |
| wrap | back to summary |
|---|---|
| public static RetainableByteBuffer wrap(ByteBuffer byteBuffer) Returns a non-retainable Use this method to wrap user-provided The returned
| |
| wrap | back to summary |
|---|---|
| public static RetainableByteBuffer wrap(ByteBuffer byteBuffer, Retainable retainable) Returns a
| |
RetainableByteBuffer instances
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public int | |
| public void | |
| public ByteBuffer | getByteBuffer()
Implements org. null, ByteBuffer.
|
| public RetainableByteBuffer | |
| public boolean | |
| public boolean | |
| public boolean | |
| public int |
| Wrapper | back to summary |
|---|---|
| public Wrapper(RetainableByteBuffer wrapped) | |
| capacity | back to summary |
|---|---|
| public int capacity() Overrides default org.
| |
| clear | back to summary |
|---|---|
| public void clear() Overrides default org.
| |
| getByteBuffer | back to summary |
|---|---|
| public ByteBuffer getByteBuffer() Implements org. Doc from org. Get the wrapped, not
| |
| getWrapped | back to summary |
|---|---|
| public RetainableByteBuffer getWrapped() Overrides org. | |
| hasRemaining | back to summary |
|---|---|
| public boolean hasRemaining() Overrides default org.
| |
| isDirect | back to summary |
|---|---|
| public boolean isDirect() Overrides default org.
| |
| isRetained | back to summary |
|---|---|
| public boolean isRetained() Implements org.
| |
| remaining | back to summary |
|---|---|
| public int remaining() Overrides default org.
| |