Package org.aion.rlp
Class Value
- java.lang.Object
-
- org.aion.rlp.Value
-
public class Value extends Object
Class to encapsulate an object and provide utilities for conversion- Author:
- ethereumJ 2014, modified by aion 2017
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BigIntegerasBigInt()byte[]asBytes()ImplNote If called for values that are not strings or byte arrays it will return an empty byte array.intasInt()List<Object>asList()longasLong()ObjectasObj()StringasString()ImplNote If called for values that are not strings or byte arrays it will return an empty string.booleancmp(Value o)byte[]encode()static ValuefromRlpEncoded(byte[] data)Valueget(int index)byte[]getData()booleanisBytes()booleanisHashCode()booleanisList()booleanisNull()booleanisString()intlength()StringtoString()
-
-
-
Constructor Detail
-
Value
public Value(Object obj)
-
-
Method Detail
-
fromRlpEncoded
public static Value fromRlpEncoded(byte[] data)
-
asObj
public Object asObj()
-
asInt
public int asInt()
- Returns:
- the numerical value as an
Integer. If called for values that are not integers or byte arrays it will return 0.
-
asLong
public long asLong()
- Returns:
- the numerical value as a
Long. If called for values that are not integers or byte arrays it will return 0.
-
asBigInt
public BigInteger asBigInt()
- Returns:
- the numerical value as a
BigInteger. If called for values that are not numbers or byte arrays it will returnBigInteger.ZERO.
-
asString
public String asString()
ImplNote If called for values that are not strings or byte arrays it will return an empty string.
-
asBytes
public byte[] asBytes()
ImplNote If called for values that are not strings or byte arrays it will return an empty byte array.
-
getData
public byte[] getData()
-
get
public Value get(int index)
-
encode
public byte[] encode()
-
cmp
public boolean cmp(Value o)
-
isList
public boolean isList()
-
isString
public boolean isString()
-
isBytes
public boolean isBytes()
-
isHashCode
public boolean isHashCode()
-
isNull
public boolean isNull()
-
length
public int length()
-
-