Class UInt

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<java.math.BigInteger>, Codec, Compactable
    Direct Known Subclasses:
    U128, U16, U256, U32, U64, U8

    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.
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from class java.math.BigInteger

        ONE, TEN, TWO, ZERO
    • Constructor Summary

      Constructors 
      Constructor Description
      UInt​(java.lang.Object value, int bitLength)  
      UInt​(java.lang.Object value, int bitLength, boolean isHexJson)  
    • Method Summary

      Modifier and Type Method Description
      java.lang.String toHex()
      Returns a hex string representation of the value
      long toNumber()  
      byte[] toU8a​(boolean isBare)  
      • Methods inherited from class java.math.BigInteger

        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, sqrt, sqrtAndRemainder, subtract, testBit, toByteArray, toString, toString, valueOf, xor
      • Methods inherited from class java.lang.Number

        byteValue, shortValue
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • UInt

        public UInt​(java.lang.Object value,
                    int bitLength,
                    boolean isHexJson)
      • UInt

        public UInt​(java.lang.Object value,
                    int bitLength)
    • Method Detail

      • toHex

        public java.lang.String toHex()
        Returns a hex string representation of the value
        Specified by:
        toHex in interface Codec
        Specified by:
        toHex in class AbstractInt
      • toU8a

        public byte[] toU8a​(boolean isBare)
        Specified by:
        toU8a in interface Codec
        Specified by:
        toU8a in class AbstractInt
        Parameters:
        isBare - true when the value has none of the type-specific prefixes (internal) Encodes the value as a Uint8Array as per the parity-codec specifications