Class DeserializerBuffer


  • public class DeserializerBuffer
    extends java.lang.Object
    Deserializing methods
    Since:
    0.1.0
    • Constructor Summary

      Constructors 
      Constructor Description
      DeserializerBuffer​(byte[] bytes)
      Initializes buffer with serialized bytes and ByteOrder.LITTLE_ENDIAN
      DeserializerBuffer​(byte[] bytes, java.nio.ByteOrder byteOrder)
      Initializes buffer with serialized bytes and byte order
      DeserializerBuffer​(java.lang.String hexString)
      Initializes buffer with serialized bytes from hex-encoded String
      DeserializerBuffer​(java.lang.String hexString, java.nio.ByteOrder byteOrder)
      Initializes buffer with serialized bytes from hex-encoded String
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.nio.ByteBuffer getBuffer()
      Retrieves the backing buffer
      protected java.math.BigInteger readBigInteger()
      Larger numeric values (e.g., U128, U256, U512) serialize as one byte of the length of the next number, followed by the two’s complement representation with little-endian byte order.
      java.lang.Boolean readBool()
      Reads a Boolean value
      byte[] readByteArray​(int length)
      Reads a byte[] from buffer
      protected byte[] readBytes​(int length)
      Reads a specified number of bytes
      float readF32()
      Reads a float of 32 bits (4 bytes)
      double readF64()
      Reads a float of 64 bits (8 bytes)
      int readI32()
      Reads a signed int of 32 bits (4 bytes)
      long readI64()
      Reads a signed int of 64 bits (8 bytes)
      java.lang.String readString()
      Reads a String value from buffer
      java.math.BigInteger readU128()
      Reads an unsigned int of 128 bits (16 bytes) max
      java.math.BigInteger readU256()
      Reads U256 from buffer
      long readU32()
      Reads an unsigned int of 32 bits (4 bytes)
      java.math.BigInteger readU512()
      Reads U512 from buffer
      java.math.BigInteger readU64()
      Reads an unsigned int of 64 bits (8 bytes)
      byte readU8()
      Reads a byte from buffer
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DeserializerBuffer

        public DeserializerBuffer​(java.lang.String hexString)
        Initializes buffer with serialized bytes from hex-encoded String
        Parameters:
        hexString - hex-encoded String to deserialize and read from
      • DeserializerBuffer

        public DeserializerBuffer​(java.lang.String hexString,
                                  java.nio.ByteOrder byteOrder)
        Initializes buffer with serialized bytes from hex-encoded String
        Parameters:
        hexString - hex-encoded String to deserialize and read from
        byteOrder - the byte order to be using
      • DeserializerBuffer

        public DeserializerBuffer​(byte[] bytes)
        Initializes buffer with serialized bytes and ByteOrder.LITTLE_ENDIAN
        Parameters:
        bytes - byte array to deserialize and read from
      • DeserializerBuffer

        public DeserializerBuffer​(byte[] bytes,
                                  java.nio.ByteOrder byteOrder)
        Initializes buffer with serialized bytes and byte order
        Parameters:
        bytes - byte array to deserialize and read from
        byteOrder - the byte order to be using