tuweni / org.apache.tuweni.bytes / Bytes / wrap

wrap

open static fun wrap(value: ByteArray!): Bytes! (source)

Wrap the provided byte array as a Bytes value.

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

Parameters

value - ByteArray!: The value to wrap.

Return
Bytes!: A Bytes value wrapping value.

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

Wrap a slice of a byte array as a Bytes 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
Bytes!: A Bytes value that expose the bytes of value from offset (inclusive) to offset + length (exclusive).

open static fun wrap(vararg values: Bytes!): Bytes! (source)

Wrap a list of other values into a concatenated view.

Note that the values are not copied and thus any future update to the values will be reflected in the returned value. If copying the inputs is desired, use #concatenate(Bytes...).

Parameters

values - Bytes!: The values to wrap.

Exceptions

IllegalArgumentException - if the result overflows an int.

Return
Bytes!: A value representing a view over the concatenation of all values.