Package org.web3j.rlp
Class RlpDecoder
java.lang.Object
org.web3j.rlp.RlpDecoder
Recursive Length Prefix (RLP) decoder.
For the specification, refer to p16 of the yellow paper and here.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic int[0xf7] If the total payload of a list is more than 55 bytes long, the RLP encoding consists of a single byte with value 0xf7 plus the length of the length of the list in binary form, followed by the length of the list, followed by the concatenation of the RLP encodings of the items.static int[0xb7] If a string is more than 55 bytes long, the RLP encoding consists of a single byte with value 0xb7 plus the length of the length of the string in binary form, followed by the length of the string, followed by the string.static int[0xc0] If the total payload of a list (i.e.static int[0x80] If a string is 0-55 bytes long, the RLP encoding consists of a single byte with value 0x80 plus the length of the string followed by the string. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
OFFSET_SHORT_STRING
public static int OFFSET_SHORT_STRING[0x80] If a string is 0-55 bytes long, the RLP encoding consists of a single byte with value 0x80 plus the length of the string followed by the string. The range of the first byte is thus [0x80, 0xb7]. -
OFFSET_LONG_STRING
public static int OFFSET_LONG_STRING[0xb7] If a string is more than 55 bytes long, the RLP encoding consists of a single byte with value 0xb7 plus the length of the length of the string in binary form, followed by the length of the string, followed by the string. For example, a length-1024 string would be encoded as \xb9\x04\x00 followed by the string. The range of the first byte is thus [0xb8, 0xbf]. -
OFFSET_SHORT_LIST
public static int OFFSET_SHORT_LIST[0xc0] If the total payload of a list (i.e. the combined length of all its items) is 0-55 bytes long, the RLP encoding consists of a single byte with value 0xc0 plus the length of the list followed by the concatenation of the RLP encodings of the items. The range of the first byte is thus [0xc0, 0xf7]. -
OFFSET_LONG_LIST
public static int OFFSET_LONG_LIST[0xf7] If the total payload of a list is more than 55 bytes long, the RLP encoding consists of a single byte with value 0xf7 plus the length of the length of the list in binary form, followed by the length of the list, followed by the concatenation of the RLP encodings of the items. The range of the first byte is thus [0xf8, 0xff].
-
-
Constructor Details
-
RlpDecoder
public RlpDecoder()
-
-
Method Details
-
decode
Parse wire byte[] message into RLP elements.- Parameters:
rlpEncoded- - RLP encoded byte-array- Returns:
- recursive RLP structure
-