public class BytesDataInfo extends DataInfo
Specialized DataInfo
for byte array content.
FLAG_CLOSE
Constructor and Description |
---|
BytesDataInfo(byte[] bytes,
boolean close) |
BytesDataInfo(long timeout,
TimeUnit unit,
byte[] bytes,
boolean close) |
BytesDataInfo(long timeout,
TimeUnit unit,
byte[] bytes,
int offset,
int length,
boolean close) |
Modifier and Type | Method and Description |
---|---|
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 . |
allocate, asByteBuffer, asBytes, asString, asString, consume, consumed, consumeInto, consumeInto, getFlags, isClose, setClose, toString
getTimeout, getUnit
public BytesDataInfo(byte[] bytes, boolean close)
public BytesDataInfo(long timeout, TimeUnit unit, byte[] bytes, boolean close)
public BytesDataInfo(long timeout, TimeUnit unit, byte[] bytes, int offset, int length, boolean close)
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 the bytes intoDataInfo.available()
,
DataInfo.consumeInto(ByteBuffer)
public int readInto(byte[] bytes, int offset, int length)
DataInfo
Copies 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.
Copyright © 1995-2015 Webtide. All Rights Reserved.