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 - ByteArray!: The value to wrap.

Return
MutableBytes!: 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 - ByteArray!: The value to wrap.

offset - Int: 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 - Int: 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
MutableBytes!: A Bytes value that expose the bytes of value from offset (inclusive) to offset + length (exclusive).