Class CLValueEncoder
- java.lang.Object
-
- java.io.OutputStream
-
- java.io.ByteArrayOutputStream
-
- com.syntifi.casper.sdk.model.clvalue.encdec.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
-
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 buffervoid
writeBool(CLValueBool clValue)
Writes a boolean value to the CLValue byte buffervoid
writeByteArray(CLValueByteArray clValue)
Writes a byte array value to the CLValue byte buffervoid
writeI32(CLValueI32 clValue)
Writes an Integer/I32 value to the CLValue byte buffervoid
writeI64(CLValueI64 clValue)
Writes a Long/I64 value to the CLValue byte buffervoid
writeKey(CLValueKey clValue)
Writes a Tag/Key Hex string to CLValue byte buffervoid
writePublicKey(CLValuePublicKey clValue)
Writes a AlgorithmTag/Key Hex string to CLValue byte buffervoid
writeString(CLValueString clValue)
Writes a String/String to the CLValue byte buffervoid
writeU128(CLValueU128 clValue)
Writes a BigInteger/U128 to the CLValue byte buffervoid
writeU256(CLValueU256 clValue)
Writes a BigInteger/U256 to the CLValue byte buffervoid
writeU32(CLValueU32 clValue)
Writes an Unsigned Integer (Long)/U32 value to the CLValue byte buffervoid
writeU512(CLValueU512 clValue)
Writes a BigInteger/U512 to the CLValue byte buffervoid
writeU64(CLValueU64 clValue)
Writes an Unsigned Long (BigInteger)/U64 to the CLValue byte buffervoid
writeU8(CLValueU8 clValue)
Writes a single byte value to the CLValue byte buffer
-
-
-
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
-
-
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
-
writeU64
public void writeU64(CLValueU64 clValue) throws java.io.IOException, CLValueEncodeException
Writes an Unsigned Long (BigInteger)/U64 to the CLValue byte buffer- Parameters:
clValue
-CLValueU64
value to encode- Throws:
java.io.IOException
CLValueEncodeException
-
writeU128
public void writeU128(CLValueU128 clValue) throws java.io.IOException, CLValueEncodeException
Writes a BigInteger/U128 to the CLValue byte buffer- Parameters:
clValue
-CLValueU128
value to encode- Throws:
java.io.IOException
CLValueEncodeException
-
writeU256
public void writeU256(CLValueU256 clValue) throws java.io.IOException, CLValueEncodeException
Writes a BigInteger/U256 to the CLValue byte buffer- Parameters:
clValue
-CLValueU256
value to encode- Throws:
java.io.IOException
CLValueEncodeException
-
writeU512
public void writeU512(CLValueU512 clValue) throws java.io.IOException, CLValueEncodeException
Writes a BigInteger/U512 to the CLValue byte buffer- Parameters:
clValue
-CLValueU512
value to encode- Throws:
java.io.IOException
CLValueEncodeException
-
writeBigInteger
protected void writeBigInteger(AbstractCLValue<java.math.BigInteger,?> clValue, CLTypeData type) throws java.io.IOException, CLValueEncodeException
Writes a BigInteger/U128-U256-U512 to the CLValue byte buffer- Parameters:
clValue
-AbstractCLValue
value to encodeclValue
-CLTypeData
CLTypeData of BigInteger- Throws:
java.io.IOException
CLValueEncodeException
-
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
-
-