public interface IByteBufferHolder
For sessions configured for optimized data copying (see
ISessionConfig.optimizeDataCopying
) this holder when used as a parameter in
session's write methods can eliminate a need for copying data during creation
of a data chunk or a datagram to write. In such case the buffers stored in this
holder will be passed directly to the I/O channel's write(ByteBuffer[]) or
the SSLEngine's wrap(ByteBuffer[], ByteBuffer) methods.
Modifier and Type | Method and Description |
---|---|
boolean |
hasRemaining()
Tells whether there are any bytes remaining in byte buffers stored in this
holder.
|
boolean |
isMessage()
Tells if this byte buffer holder should be treated as a message or raw bytes
when it is processed thru an encoding pipeline.
|
int |
remaining()
Returns the total number of bytes remaining in all byte buffers stored in
this holder.
|
ByteBuffer[] |
toArray()
Returns an array containing all of byte buffers stored in this holder in
proper sequence (from first to last buffer buffer to send).
|
boolean hasRemaining()
true
if, and only if, there is at least one byte remaining in
byte buffers stored in this holderint remaining()
ByteBuffer[] toArray()
The returned array should be "safe" in that no references to it are maintained by this holder. (In other words, this method must allocate a new array). The caller is thus free to modify the returned array.
boolean isMessage()
When true
is returned the processing will start from the last encoder
in the pipeline with inbound type matching a class implementing this
interface or this interface itself.
In other case, when false
is returned, the processing will start from
the last encoder with inbound type that is either byte[]
,
ByteBuffer
or this interface itself.
true
if this holder should be treated as a messageCopyright © 2017–2022 SNF4J.ORG. All rights reserved.