tuweni / org.apache.tuweni.bytes / MutableBytes / wrapByteBuffer

wrapByteBuffer

open static fun wrapByteBuffer(byteBuffer: ByteBuffer!): MutableBytes! (source)

Wrap a full Java NIO ByteBuffer as a MutableBytes value.

Note that any change to the content of the buffer may be reflected in the returned value.

Parameters

byteBuffer - ByteBuffer!: The ByteBuffer to wrap.

Return
MutableBytes!: A MutableBytes value.

open static fun wrapByteBuffer(byteBuffer: ByteBuffer!, offset: Int, size: Int): MutableBytes! (source)

Wrap a slice of a Java NIO ByteBuffer as a MutableBytes value.

Note that any change to the content of the buffer may be reflected in the returned value, and any change to the returned value will be reflected in the buffer.

Parameters

byteBuffer - ByteBuffer!: The ByteBuffer to wrap.

offset - Int: 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 - Int: The size of the returned value.

Exceptions

IndexOutOfBoundsException - if offset < 0 || (byteBuffer.limit() > 0 && offset >= byteBuffer.limit()).

IllegalArgumentException - if length < 0 || offset + length > byteBuffer.limit().

Return
MutableBytes!: A MutableBytes value.