tuweni / org.apache.tuweni.bytes / Bytes32 / wrap

wrap

open static fun wrap(bytes: ByteArray!): Bytes32! (source)

Wrap the provided byte array, which must be of length 32, as a Bytes32.

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

Parameters

bytes - ByteArray!: The bytes to wrap.

Exceptions

IllegalArgumentException - if value.length != 32.

Return
Bytes32!: A Bytes32 wrapping value.

open static fun wrap(bytes: ByteArray!, offset: Int): Bytes32! (source)

Wrap a slice/sub-part of the provided array as a Bytes32.

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

Parameters

bytes - ByteArray!: The bytes 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, i).get(0) == value[i].

Exceptions

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

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

Return
Bytes32!: A Bytes32 that exposes the bytes of value from offset (inclusive) to offset + 32 (exclusive).

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

Wrap a the provided value, which must be of size 32, as a Bytes32.

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

Parameters

value - Bytes!: The bytes to wrap.

Exceptions

IllegalArgumentException - if value.size() != 32.

Return
Bytes32!: A Bytes32 that exposes the bytes of value.

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

Wrap a slice/sub-part of the provided value as a Bytes32.

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

Parameters

value - Bytes!: The bytes 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, i).get(0) == value.get(i).

Exceptions

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

IllegalArgumentException - if length < 0 || offset + 32 > value.size().

Return
Bytes32!: A Bytes32 that exposes the bytes of value from offset (inclusive) to offset + 32 (exclusive).