Interface MutableBytes32

All Superinterfaces:
Bytes, Bytes32, Comparable<Bytes>, MutableBytes

public interface MutableBytes32 extends MutableBytes, Bytes32
A mutable Bytes32, that is a mutable Bytes value of exactly 32 bytes.
  • Method Details

    • create

      static MutableBytes32 create()
      Create a new mutable 32 bytes value.
      Returns:
      A newly allocated MutableBytes value.
    • wrap

      static MutableBytes32 wrap(byte[] value)
      Wrap a 32 bytes array as a mutable 32 bytes value.
      Parameters:
      value - The value to wrap.
      Returns:
      A MutableBytes32 wrapping value.
      Throws:
      IllegalArgumentException - if value.length != 32.
    • wrap

      static MutableBytes32 wrap(byte[] value, int offset)
      Wrap a the provided array as a MutableBytes32.

      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 - The bytes 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, i).get(0) == value[i].
      Returns:
      A MutableBytes32 that exposes the bytes of value from offset (inclusive) to offset + 32 (exclusive).
      Throws:
      IndexOutOfBoundsException - if offset < 0 || (value.length > 0 && offset >= value.length).
      IllegalArgumentException - if length < 0 || offset + 32 > value.length.
    • wrap

      static MutableBytes32 wrap(MutableBytes value)
      Wrap a the provided value, which must be of size 32, as a MutableBytes32.

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

      Parameters:
      value - The bytes to wrap.
      Returns:
      A MutableBytes32 that exposes the bytes of value.
      Throws:
      IllegalArgumentException - if value.size() != 32.
    • wrap

      static MutableBytes32 wrap(MutableBytes value, int offset)
      Wrap a slice/sub-part of the provided value as a MutableBytes32.

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

      Parameters:
      value - The bytes 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, i).get(0) == value.get(i).
      Returns:
      A Bytes32 that exposes the bytes of value from offset (inclusive) to offset + 32 (exclusive).
      Throws:
      IndexOutOfBoundsException - if offset < 0 || (value.size() > 0 && offset >= value.size()).
      IllegalArgumentException - if length < 0 || offset + 32 > value.size().