Package org.apache.tuweni.bytes
Interface MutableBytes32
- All Superinterfaces:
Bytes,Bytes32,Comparable<Bytes>,MutableBytes
-
Field Summary
Fields inherited from interface org.apache.tuweni.bytes.MutableBytes
EMPTY -
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic MutableBytes32create()Create a new mutable 32 bytes value.static MutableBytes32wrap(byte[] value) Wrap a 32 bytes array as a mutable 32 bytes value.static MutableBytes32wrap(byte[] value, int offset) Wrap a the provided array as aMutableBytes32.static MutableBytes32wrap(MutableBytes value) Wrap a the provided value, which must be of size 32, as aMutableBytes32.static MutableBytes32wrap(MutableBytes value, int offset) Wrap a slice/sub-part of the provided value as aMutableBytes32.Methods inherited from interface org.apache.tuweni.bytes.Bytes
and, and, appendHexTo, appendTo, appendTo, bitLength, commonPrefix, commonPrefixLength, compareTo, copyTo, copyTo, get, getInt, getInt, getLong, getLong, hasLeadingZero, hasLeadingZeroByte, isEmpty, isZero, not, numberOfLeadingZeroBytes, numberOfLeadingZeros, numberOfTrailingZeroBytes, or, or, reverse, shiftLeft, shiftRight, slice, slice, toArray, toArray, toArrayUnsafe, toBase64String, toBigInteger, toBigInteger, toEllipsisHexString, toFastHex, toHexString, toInt, toInt, toLong, toLong, toQuantityHexString, toShortHexString, toString, toUnprefixedHexString, toUnsignedBigInteger, toUnsignedBigInteger, trimLeadingZeros, trimTrailingZeros, update, xor, xorMethods inherited from interface org.apache.tuweni.bytes.Bytes32
and, copy, mutableCopy, not, or, shiftLeft, shiftRight, size, xorMethods inherited from interface org.apache.tuweni.bytes.MutableBytes
clear, decrement, fill, increment, mutableSlice, set, set, setInt, setLong
-
Method Details
-
create
Create a new mutable 32 bytes value.- Returns:
- A newly allocated
MutableBytesvalue.
-
wrap
Wrap a 32 bytes array as a mutable 32 bytes value.- Parameters:
value- The value to wrap.- Returns:
- A
MutableBytes32wrappingvalue. - Throws:
IllegalArgumentException- ifvalue.length != 32.
-
wrap
Wrap a the provided array as aMutableBytes32.Note that value is not copied, only wrapped, and thus any future update to
valuewithin the wrapped parts will be reflected in the returned value.- Parameters:
value- The bytes to wrap.offset- The index (inclusive) invalueof the first byte exposed by the returned value. In other words, you will havewrap(value, i).get(0) == value[i].- Returns:
- A
MutableBytes32that exposes the bytes ofvaluefromoffset(inclusive) tooffset + 32(exclusive). - Throws:
IndexOutOfBoundsException- ifoffset < 0 || (value.length > 0 && offset >= value.length).IllegalArgumentException- iflength < 0 || offset + 32 > value.length.
-
wrap
Wrap a the provided value, which must be of size 32, as aMutableBytes32.Note that value is not copied, only wrapped, and thus any future update to
valuewill be reflected in the returned value.- Parameters:
value- The bytes to wrap.- Returns:
- A
MutableBytes32that exposes the bytes ofvalue. - Throws:
IllegalArgumentException- ifvalue.size() != 32.
-
wrap
Wrap a slice/sub-part of the provided value as aMutableBytes32.Note that the value is not copied, and thus any future update to
valuewithin the wrapped parts will be reflected in the returned value.- Parameters:
value- The bytes to wrap.offset- The index (inclusive) invalueof the first byte exposed by the returned value. In other words, you will havewrap(value, i).get(0) == value.get(i).- Returns:
- A
Bytes32that exposes the bytes ofvaluefromoffset(inclusive) tooffset + 32(exclusive). - Throws:
IndexOutOfBoundsException- ifoffset < 0 || (value.size() > 0 && offset >= value.size()).IllegalArgumentException- iflength < 0 || offset + 32 > value.size().
-