tuweni / org.apache.tuweni.bytes / MutableBytes / wrap

wrap

open static fun wrap(value: ByteArray): MutableBytes (source)

Wrap a byte array in a MutableBytes value.

Parameters

value - The value to wrap.

Return
A MutableBytes value wrapping value.

open static fun wrap(value: ByteArray, offset: Int, length: Int): MutableBytes (source)

Wrap a slice of a byte array as a MutableBytes value.

Note that value is not copied and thus any future update to value within the slice will be reflected in the returned value.

Parameters

value - The value to wrap.

offset - The index (inclusive) in value of the first byte exposed by the returned value. In other words, you will have wrap(value, o, l).get(0) == value[o].

length - The length of the resulting value.

Exceptions

IndexOutOfBoundsException - if offset < 0 || (value.length > 0 && offset >= value.length).

IllegalArgumentException - if length < 0 || offset + length > value.length.

Return
A Bytes value that expose the bytes of value from offset (inclusive) to offset + length (exclusive).