public class ByteBufferDataInfo extends DataInfo
Specialized DataInfo
for ByteBuffer
content.
FLAG_CLOSE, FLAG_COMPRESS
Constructor and Description |
---|
ByteBufferDataInfo(ByteBuffer buffer,
boolean close) |
ByteBufferDataInfo(ByteBuffer buffer,
boolean close,
boolean compress) |
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(ByteBuffer output)
Copies the content bytes of this
DataInfo into the given ByteBuffer . |
asByteBuffer, asBytes, asString, consume, consumed, consumeInto, getFlags, isClose, isCompress, setClose, setCompress, toString
public ByteBufferDataInfo(ByteBuffer buffer, boolean close)
public ByteBufferDataInfo(ByteBuffer buffer, boolean close, boolean compress)
public int length()
length
in class DataInfo
DataInfo.available()
public int available()
DataInfo
Returns 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 DataInfo
DataInfo.readInto(ByteBuffer)
public int readInto(ByteBuffer output)
DataInfo
Copies 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 DataInfo
output
- the ByteBuffer
to copy to bytes intoDataInfo.available()
,
DataInfo.consumeInto(ByteBuffer)
protected ByteBuffer allocate(int size)
Copyright © 1995-2015 Mort Bay Consulting. All Rights Reserved.