open static fun wrapByteBuffer(byteBuffer: ByteBuffer): Bytes
(source)
Wrap a full Java NIO ByteBuffer as a Bytes value.
Note that any change to the content of the byteBuf may be reflected in the returned value.
byteBuffer
- The ByteBuffer to wrap.
Return
A Bytes value.
open static fun wrapByteBuffer(byteBuffer: ByteBuffer, offset: Int, size: Int): Bytes
(source)
Wrap a slice of a Java NIO ByteBuf as a Bytes value.
Note that any change to the content of the buffer may be reflected in the returned value.
byteBuffer
- The ByteBuffer to wrap.
offset
- The offset in byteBuffer
from which to expose the bytes in the returned value. That is, wrapByteBuffer(byteBuffer, i, 1).get(0) == byteBuffer.getByte(i)
.
size
- The size of the returned value.
IndexOutOfBoundsException
- if offset < 0 || (byteBuffer.limit() > 0 && offset >= byteBuf.limit())
.
IllegalArgumentException
- if length < 0 || offset + length > byteBuffer.limit()
.
Return
A Bytes value.