public class UInt extends AbstractInt implements Compactable
UInt A generic unsigned integer codec. For Substrate all numbers are LE encoded, this handles the encoding and decoding of those numbers. Upon construction the bitLength is provided and any additional use keeps the number to this length. This extends BN
, so all methods available on a normal BN
object is available here.
Constructor and Description |
---|
UInt(java.lang.Object value,
int bitLength) |
UInt(java.lang.Object value,
int bitLength,
boolean isHexJson) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
toHex()
Returns a hex string representation of the value
|
long |
toNumber() |
byte[] |
toU8a(boolean isBare) |
bitLength, eq, getEncodedLength, isEmpty, toBn, toJson
abs, add, and, andNot, bitCount, byteValueExact, clearBit, compareTo, divide, divideAndRemainder, doubleValue, equals, flipBit, floatValue, gcd, getLowestSetBit, hashCode, intValue, intValueExact, isProbablePrime, longValue, longValueExact, max, min, mod, modInverse, modPow, multiply, negate, nextProbablePrime, not, or, pow, probablePrime, remainder, setBit, shiftLeft, shiftRight, shortValueExact, signum, subtract, testBit, toByteArray, toString, toString, valueOf, xor
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
bitLength, toBn
eq, getConstructorCodec, getEncodedLength, isEmpty, toJson, toU8a
public UInt(java.lang.Object value, int bitLength, boolean isHexJson)
public UInt(java.lang.Object value, int bitLength)
public java.lang.String toHex()
Returns a hex string representation of the value
toHex
in interface Codec
toHex
in class AbstractInt
public byte[] toU8a(boolean isBare)
toU8a
in interface Codec
toU8a
in class AbstractInt
isBare
- true when the value has none of the type-specific prefixes (internal) Encodes the value as a Uint8Array as per the parity-codec specificationspublic long toNumber()
toNumber
in interface Compactable