public class ByteBufferDataInfo extends DataInfo
Specialized DataInfo for ByteBuffer content.
FLAG_CLOSE| Constructor and Description |
|---|
ByteBufferDataInfo(ByteBuffer buffer,
boolean close) |
ByteBufferDataInfo(long timeout,
TimeUnit unit,
ByteBuffer buffer,
boolean close) |
| Modifier and Type | Method and Description |
|---|---|
protected ByteBuffer |
allocate(int size) |
int |
available()
Returns the available content bytes that can be read via
DataInfo.readInto(ByteBuffer). |
int |
length() |
int |
readInto(byte[] bytes,
int offset,
int length)
Copies the content bytes of this
DataInfo into the given byte array. |
int |
readInto(ByteBuffer output)
Copies the content bytes of this
DataInfo into the given ByteBuffer. |
asByteBuffer, asBytes, asString, asString, consume, consumed, consumeInto, consumeInto, getFlags, isClose, setClose, toStringgetTimeout, getUnitpublic ByteBufferDataInfo(ByteBuffer buffer, boolean close)
public ByteBufferDataInfo(long timeout,
TimeUnit unit,
ByteBuffer buffer,
boolean close)
public int length()
length in class DataInfoDataInfo.available()public int available()
DataInfoReturns the available content bytes that can be read via DataInfo.readInto(ByteBuffer).
Each invocation to DataInfo.readInto(ByteBuffer) modifies the value returned by this method,
until no more content bytes are available.
available in class DataInfoDataInfo.readInto(ByteBuffer)public int readInto(ByteBuffer output)
DataInfoCopies the content bytes of this DataInfo into the given ByteBuffer.
If the given ByteBuffer cannot contain the whole content of this DataInfo
then after the read DataInfo.available() will return a positive value, and further content
may be retrieved by invoking again this method with a new output buffer.
readInto in class DataInfooutput - the ByteBuffer to copy the bytes intoDataInfo.available(),
DataInfo.consumeInto(ByteBuffer)public int readInto(byte[] bytes,
int offset,
int length)
DataInfoCopies the content bytes of this DataInfo into the given byte array.
If the given byte array cannot contain the whole content of this DataInfo
then after the read DataInfo.available() will return a positive value, and further content
may be retrieved by invoking again this method with a new byte array.
protected ByteBuffer allocate(int size)
Copyright © 1995-2015 Webtide. All Rights Reserved.