-
public interface WritableComponent
A view onto the buffer component being processed in a given iteration ofBuffer.forEachWritable(int, WritableComponentProcessor)
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
hasWritableArray()
Check if this component is backed by a cached byte array that can be accessed cheaply.WritableComponent
skipWritableBytes(int byteCount)
Move the write-offset to indicate that the given number of bytes were written to this component.byte[]
writableArray()
Get a byte array of the contents of this component.int
writableArrayLength()
The number of bytes in thewritableArray()
that belong to this component.int
writableArrayOffset()
An offset into thewritableArray()
where this component starts.ByteBuffer
writableBuffer()
Get aByteBuffer
instance for this memory component, which can be used for modifying the buffer contents.int
writableBytes()
Get the space available to be written to this component, as a number of bytes.long
writableNativeAddress()
Give the native memory address backing this buffer, or return 0 if this buffer has no native memory address.
-
-
-
Method Detail
-
hasWritableArray
boolean hasWritableArray()
Check if this component is backed by a cached byte array that can be accessed cheaply.- Returns:
true
ifwritableArray()
is a cheap operation, otherwisefalse
.
-
writableArray
byte[] writableArray()
Get a byte array of the contents of this component.- Returns:
- A byte array of the contents of this component.
- Throws:
UnsupportedOperationException
- ifhasWritableArray()
returnsfalse
.- See Also:
writableArrayOffset()
,writableArrayLength()
-
writableArrayOffset
int writableArrayOffset()
An offset into thewritableArray()
where this component starts.- Returns:
- An offset into
writableArray()
. - Throws:
UnsupportedOperationException
- ifhasWritableArray()
returnsfalse
.
-
writableArrayLength
int writableArrayLength()
The number of bytes in thewritableArray()
that belong to this component.- Returns:
- The number of bytes, from the
writableArrayOffset()
into thewritableArray()
, that belong to this component. - Throws:
UnsupportedOperationException
- ifhasWritableArray()
returnsfalse
.
-
writableNativeAddress
long writableNativeAddress()
Give the native memory address backing this buffer, or return 0 if this buffer has no native memory address.- Returns:
- The native memory address, if any, otherwise 0.
-
writableBytes
int writableBytes()
Get the space available to be written to this component, as a number of bytes.- Returns:
- The maximum number of bytes that can be written to this component.
-
writableBuffer
ByteBuffer writableBuffer()
Get aByteBuffer
instance for this memory component, which can be used for modifying the buffer contents.- Returns:
- A new
ByteBuffer
, with its own position and limit, for this memory component.
-
skipWritableBytes
WritableComponent skipWritableBytes(int byteCount)
Move the write-offset to indicate that the given number of bytes were written to this component.- Parameters:
byteCount
- The number of bytes written to this component.- Returns:
- itself.
- See Also:
Buffer.skipWritableBytes(int)
-
-