public final class DataByteArrayChannel extends Object implements DataBuffer
Constructor and Description |
---|
DataByteArrayChannel(byte[] byteArray,
long offset,
long length) |
Modifier and Type | Method and Description |
---|---|
long |
getLength()
Returns the length of the data.
|
Object |
getNettyOutput()
Returns an object for writing to a netty channel.
|
ByteBuffer |
getReadOnlyByteBuffer()
Returns a
ByteBuffer for read-only access to the data. |
int |
readableBytes() |
void |
readBytes(byte[] dst,
int dstIndex,
int length)
Transfers this buffer's data to the specified destination starting at
the current
readerIndex and increases the readerIndex
by the number of the transferred bytes (= length ). |
void |
release()
Releases the underlying buffer of this DataBuffer if no longer needed.
|
public DataByteArrayChannel(byte[] byteArray, long offset, long length)
byteArray
- the array representing the dataoffset
- the offset into the byteArraylength
- the length of the datapublic Object getNettyOutput()
DataBuffer
getNettyOutput
in interface DataBuffer
public long getLength()
DataBuffer
getLength
in interface DataBuffer
public ByteBuffer getReadOnlyByteBuffer()
DataBuffer
ByteBuffer
for read-only access to the data.getReadOnlyByteBuffer
in interface DataBuffer
public void readBytes(byte[] dst, int dstIndex, int length)
DataBuffer
readerIndex
and increases the readerIndex
by the number of the transferred bytes (= length
).readBytes
in interface DataBuffer
dst
- the destinationdstIndex
- the first index of the destinationlength
- the number of bytes to transferpublic int readableBytes()
readableBytes
in interface DataBuffer
public void release()
DataBuffer
release
in interface DataBuffer
Copyright © 2023. All Rights Reserved.