Class CLValueEncoder

  • All Implemented Interfaces:
    java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable

    public class CLValueEncoder
    extends java.io.ByteArrayOutputStream
    Casper CLValue Encoding methods
    Since:
    0.0.1
    See Also:
    AbstractCLValue
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.math.BigInteger MAX_U128  
      static java.math.BigInteger MAX_U256  
      static java.math.BigInteger MAX_U512  
      static java.math.BigInteger MAX_U64  
      static java.math.BigInteger ONE  
      static java.math.BigInteger TWO  
      static java.math.BigInteger ZERO  
      • Fields inherited from class java.io.ByteArrayOutputStream

        buf, count
    • Constructor Summary

      Constructors 
      Constructor Description
      CLValueEncoder()
      Initializes buffer as zero-length
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void writeAny​(CLValueAny clValue)  
      protected void writeBigInteger​(AbstractCLValue<java.math.BigInteger,​?> clValue, CLTypeData type)
      Writes a BigInteger/U128-U256-U512 to the CLValue byte buffer
      void writeBool​(CLValueBool clValue)
      Writes a boolean value to the CLValue byte buffer
      void writeByteArray​(CLValueByteArray clValue)
      Writes a byte array value to the CLValue byte buffer
      void writeI32​(CLValueI32 clValue)
      Writes an Integer/I32 value to the CLValue byte buffer
      void writeI64​(CLValueI64 clValue)
      Writes a Long/I64 value to the CLValue byte buffer
      void writeKey​(CLValueKey clValue)
      Writes a Tag/Key Hex string to CLValue byte buffer
      void writePublicKey​(CLValuePublicKey clValue)
      Writes a AlgorithmTag/Key Hex string to CLValue byte buffer
      void writeString​(CLValueString clValue)
      Writes a String/String to the CLValue byte buffer
      void writeU128​(CLValueU128 clValue)
      Writes a BigInteger/U128 to the CLValue byte buffer
      void writeU256​(CLValueU256 clValue)
      Writes a BigInteger/U256 to the CLValue byte buffer
      void writeU32​(CLValueU32 clValue)
      Writes an Unsigned Integer (Long)/U32 value to the CLValue byte buffer
      void writeU512​(CLValueU512 clValue)
      Writes a BigInteger/U512 to the CLValue byte buffer
      void writeU64​(CLValueU64 clValue)
      Writes an Unsigned Long (BigInteger)/U64 to the CLValue byte buffer
      void writeU8​(CLValueU8 clValue)
      Writes a single byte value to the CLValue byte buffer
      • Methods inherited from class java.io.ByteArrayOutputStream

        close, reset, size, toByteArray, toString, toString, toString, toString, write, write, writeBytes, writeTo
      • Methods inherited from class java.io.OutputStream

        flush, nullOutputStream, write
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • ZERO

        public static final java.math.BigInteger ZERO
      • ONE

        public static final java.math.BigInteger ONE
      • TWO

        public static final java.math.BigInteger TWO
      • MAX_U64

        public static final java.math.BigInteger MAX_U64
      • MAX_U128

        public static final java.math.BigInteger MAX_U128
      • MAX_U256

        public static final java.math.BigInteger MAX_U256
      • MAX_U512

        public static final java.math.BigInteger MAX_U512
    • Constructor Detail

      • CLValueEncoder

        public CLValueEncoder()
        Initializes buffer as zero-length
    • Method Detail

      • writeBool

        public void writeBool​(CLValueBool clValue)
                       throws java.io.IOException
        Writes a boolean value to the CLValue byte buffer
        Parameters:
        clValue - CLValueBool value to encode
        Throws:
        java.io.IOException
      • writeU8

        public void writeU8​(CLValueU8 clValue)
        Writes a single byte value to the CLValue byte buffer
        Parameters:
        clValue - CLValueU8 value to encode
      • writeByteArray

        public void writeByteArray​(CLValueByteArray clValue)
                            throws java.io.IOException
        Writes a byte array value to the CLValue byte buffer
        Parameters:
        clValue - CLValueByteArray value to encode
        Throws:
        java.io.IOException
      • writeI32

        public void writeI32​(CLValueI32 clValue)
                      throws java.io.IOException
        Writes an Integer/I32 value to the CLValue byte buffer
        Parameters:
        clValue - CLValueI32 value to encode
        Throws:
        java.io.IOException
      • writeU32

        public void writeU32​(CLValueU32 clValue)
                      throws java.io.IOException
        Writes an Unsigned Integer (Long)/U32 value to the CLValue byte buffer
        Parameters:
        clValue - CLValueU32 value to encode
        Throws:
        java.io.IOException
      • writeI64

        public void writeI64​(CLValueI64 clValue)
                      throws java.io.IOException
        Writes a Long/I64 value to the CLValue byte buffer
        Parameters:
        clValue - CLValueI64 value to encode
        Throws:
        java.io.IOException
      • writeString

        public void writeString​(CLValueString clValue)
                         throws java.io.IOException
        Writes a String/String to the CLValue byte buffer
        Parameters:
        clValue - CLValueString value to encode
        Throws:
        java.io.IOException
      • writePublicKey

        public void writePublicKey​(CLValuePublicKey clValue)
        Writes a AlgorithmTag/Key Hex string to CLValue byte buffer
        Parameters:
        clValue - CLValuePublicKey value to encode
      • writeKey

        public void writeKey​(CLValueKey clValue)
        Writes a Tag/Key Hex string to CLValue byte buffer
        Parameters:
        clValue - CLValueKey value to encode
      • writeAny

        public void writeAny​(CLValueAny clValue)
                      throws java.io.IOException
        Throws:
        java.io.IOException