Package org.fisco.bcos.sdk.rlp
Class RlpDecoder
java.lang.Object
org.fisco.bcos.sdk.rlp.RlpDecoder
public final class RlpDecoder
extends java.lang.Object
Recursive Length Prefix (RLP) decoder.
-
Field Summary
Fields Modifier and Type Field Description 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.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.static int
OFFSET_SHORT_LIST
[0xc0] If the total payload of a list (i.e.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. -
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].
-
-
Method Details
-
decode
Parse wire byte[] message into RLP elements.- Parameters:
rlpEncoded
- - RLP encoded byte-array- Returns:
- recursive RLP structure
-