tuweni / org.apache.tuweni.bytes / MutableBytes / wrapByteBuf

wrapByteBuf

open static fun wrapByteBuf(byteBuf: ByteBuf!): MutableBytes! (source)

Wrap a full Netty ByteBuf as a MutableBytes value.

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

Parameters

byteBuf - ByteBuf!: The ByteBuf to wrap.

Return
MutableBytes!: A MutableBytes value.

open static fun wrapByteBuf(byteBuf: ByteBuf!, offset: Int, size: Int): MutableBytes! (source)

Wrap a slice of a Netty ByteBuf 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

byteBuf - ByteBuf!: The ByteBuf to wrap.

offset - Int: The offset in byteBuf from which to expose the bytes in the returned value. That is, wrapByteBuf(byteBuf, i, 1).get(0) == byteBuf.getByte(i).

size - Int: The size of the returned value.

Exceptions

IndexOutOfBoundsException - if offset < 0 || (byteBuf.capacity() > 0 && offset >= byteBuf.capacity()).

IllegalArgumentException - if length < 0 || offset + length > byteBuf.capacity().

Return
MutableBytes!: A MutableBytes value.