public interface Bytes32 extends Bytes
Bytes value that is guaranteed to contain exactly 32 bytes.| 限定符和类型 | 字段和说明 |
|---|---|
static int |
SIZE
The number of bytes in this value - i.e. 32
|
static Bytes32 |
ZERO
A
Bytes32 containing all zero bytes |
| 限定符和类型 | 方法和说明 |
|---|---|
default Bytes32 |
and(Bytes32 other)
Return a bit-wise AND of these bytes and the supplied bytes.
|
Bytes32 |
copy()
Return a value equivalent to this one but guaranteed to 1) be deeply immutable
(i.e. the underlying value will be immutable) and 2) to not retain more bytes than
exposed by the value.
|
static Bytes32 |
fromHexString(CharSequence str)
Parse a hexadecimal string into a
Bytes32. |
static Bytes32 |
fromHexStringLenient(CharSequence str)
Parse a hexadecimal string into a
Bytes32. |
static Bytes32 |
fromHexStringStrict(CharSequence str)
Parse a hexadecimal string into a
Bytes32. |
static Bytes32 |
leftPad(Bytes value)
|
MutableBytes32 |
mutableCopy()
Return a new mutable value initialized with the content of this value.
|
default Bytes32 |
not()
Return a bit-wise NOT of these bytes.
|
default Bytes32 |
or(Bytes32 other)
Return a bit-wise OR of these bytes and the supplied bytes.
|
static Bytes32 |
random()
Generate random bytes.
|
static Bytes32 |
random(Random generator)
Generate random bytes.
|
static Bytes32 |
rightPad(Bytes value)
|
default Bytes32 |
shiftLeft(int distance)
Shift all bits in this value to the left.
|
default Bytes32 |
shiftRight(int distance)
Shift all bits in this value to the right.
|
default int |
size()
Provides the number of bytes this value represents.
|
static Bytes32 |
wrap(byte[] bytes)
Wrap the provided byte array, which must be of length 32, as a
Bytes32. |
static Bytes32 |
wrap(byte[] bytes,
int offset)
Wrap a slice/sub-part of the provided array as a
Bytes32. |
static Bytes32 |
wrap(Bytes value)
Wrap a the provided value, which must be of size 32, as a
Bytes32. |
static Bytes32 |
wrap(Bytes value,
int offset)
Wrap a slice/sub-part of the provided value as a
Bytes32. |
default Bytes32 |
xor(Bytes32 other)
Return a bit-wise XOR of these bytes and the supplied bytes.
|
and, and, appendHexTo, appendTo, appendTo, bitLength, commonPrefix, commonPrefixLength, compareTo, concatenate, concatenate, copyTo, copyTo, fromBase64String, fromHexString, fromHexStringLenient, get, getInt, getInt, getLong, getLong, hasLeadingZero, hasLeadingZeroByte, isEmpty, isZero, minimalBytes, not, numberOfLeadingZeroBytes, numberOfLeadingZeros, numberOfTrailingZeroBytes, of, of, ofUnsignedInt, ofUnsignedInt, ofUnsignedLong, ofUnsignedLong, ofUnsignedShort, ofUnsignedShort, or, or, random, random, reverse, shiftLeft, shiftRight, slice, slice, toArray, toArray, toArrayUnsafe, toBase64String, toBigInteger, toBigInteger, toEllipsisHexString, toHexString, toInt, toInt, toLong, toLong, toQuantityHexString, toShortHexString, toString, toUnprefixedHexString, toUnsignedBigInteger, toUnsignedBigInteger, trimLeadingZeros, update, wrap, wrap, wrapBuffer, wrapBuffer, wrapByteBuf, wrapByteBuf, wrapByteBuffer, wrapByteBuffer, xor, xorstatic final int SIZE
static final Bytes32 ZERO
Bytes32 containing all zero bytesstatic Bytes32 wrap(byte[] bytes)
Bytes32.
Note that value is not copied, only wrapped, and thus any future update to
value will be reflected in the returned value.
wrap 在接口中 Bytesbytes - The bytes to wrap.Bytes32 wrapping value.IllegalArgumentException - if value.length != 32.static Bytes32 wrap(byte[] bytes, int offset)
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.
bytes - 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].Bytes32 that exposes the bytes of value from
offset (inclusive) to offset + 32 (exclusive).IndexOutOfBoundsException - if
offset < 0 || (value.length > 0 && offset >=
value.length).IllegalArgumentException - if
length < 0 || offset + 32 > value.length.static Bytes32 wrap(Bytes value)
Bytes32.
Note that value is not copied, only wrapped, and thus any future update to
value will be reflected in the returned value.
value - The bytes to wrap.Bytes32 that exposes the bytes of value.IllegalArgumentException - if value.size() != 32.static Bytes32 wrap(Bytes value, int offset)
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.
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).Bytes32 that exposes the bytes of value from
offset (inclusive) to offset + 32 (exclusive).IndexOutOfBoundsException - if
offset < 0 || (value.size() > 0 && offset >=
value.size()).IllegalArgumentException - if
length < 0 || offset + 32 > value.size().static Bytes32 leftPad(Bytes value)
value - The bytes value pad.Bytes32 that exposes the left-padded bytes of value.IllegalArgumentException - if value.size() > 32.static Bytes32 rightPad(Bytes value)
value - The bytes value pad.Bytes32 that exposes the rightw-padded bytes of value.IllegalArgumentException - if value.size() > 32.static Bytes32 fromHexStringLenient(CharSequence str)
Bytes32.
This method is lenient in that str may of an odd length, in which case it
will behave exactly as if it had an additional 0 in front.
fromHexStringLenient 在接口中 Bytesstr - The hexadecimal string to parse, which may or may not start with "0x".
That representation may contain less than 32 bytes, in which case the result is
left padded with zeros (see fromHexStringStrict(java.lang.CharSequence) if this is not what you
want).str.IllegalArgumentException - if str does not correspond to a valid
hexadecimal representation or contains more than 32 bytes.static Bytes32 fromHexString(CharSequence str)
Bytes32.
This method is strict in that str must of an even length.
fromHexString 在接口中 Bytesstr - The hexadecimal string to parse, which may or may not start with "0x".
That representation may contain less than 32 bytes, in which case the result is
left padded with zeros (see fromHexStringStrict(java.lang.CharSequence) if this is not what you
want).str.IllegalArgumentException - if str does not correspond to a valid
hexadecimal representation, is of an odd length, or contains more than 32 bytes.static Bytes32 random()
static Bytes32 random(Random generator)
generator - The generator for random bytes.static Bytes32 fromHexStringStrict(CharSequence str)
Bytes32.
This method is extra strict in that str must of an even length and the
provided representation must have exactly 32 bytes.
str - The hexadecimal string to parse, which may or may not start with "0x".str.IllegalArgumentException - if str does not correspond to a valid
hexadecimal representation, is of an odd length or does not contain exactly 32
bytes.default int size()
Bytesdefault Bytes32 and(Bytes32 other)
other - The bytes to perform the operation with.default Bytes32 or(Bytes32 other)
other - The bytes to perform the operation with.default Bytes32 xor(Bytes32 other)
other - The bytes to perform the operation with.default Bytes32 shiftRight(int distance)
BytesshiftRight 在接口中 Bytesdistance - The number of bits to shift by.default Bytes32 shiftLeft(int distance)
BytesBytes32 copy()
BytesMutableBytes32 mutableCopy()
BytesmutableCopy 在接口中 BytesCopyright © 2021. All rights reserved.