public class SingleByteBufferHolder extends Object implements IByteBufferHolder
Constructor and Description |
---|
SingleByteBufferHolder(ByteBuffer buffer)
Construct a byte buffer holder storing one specified byte buffer.
|
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).
|
public SingleByteBufferHolder(ByteBuffer buffer)
buffer
- the byte buffer to be stored by this holderIllegalArgumentException
- if the buffer
is nullpublic boolean hasRemaining()
IByteBufferHolder
hasRemaining
in interface IByteBufferHolder
true
if, and only if, there is at least one byte remaining in
byte buffers stored in this holderpublic int remaining()
IByteBufferHolder
remaining
in interface IByteBufferHolder
public ByteBuffer[] toArray()
IByteBufferHolder
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.
toArray
in interface IByteBufferHolder
public 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.
isMessage
in interface IByteBufferHolder
false
Copyright © 2017–2022 SNF4J.ORG. All rights reserved.