public final class RLPEncoder
extends java.lang.Object
| 构造器和说明 |
|---|
RLPEncoder() |
| 限定符和类型 | 方法和说明 |
|---|---|
static long |
dataLen(KeyValuePair[] pairs) |
static byte[] |
encode(byte b)
Returns the RLP encoding of the given byte.
|
static byte[] |
encode(byte[] byteString)
Returns the RLP encoding of the given byte string.
|
static byte[] |
encodeAsList(java.lang.Iterable<?> elements)
Returns the encoding of an RLP list item containing the encoded elements of the given
Iterable in the
given order. |
static void |
encodeAsList(java.lang.Iterable<?> elements,
byte[] dest,
int destIndex)
Inserts the encoding of an RLP list item, containing the encoded elements of the
Iterable in the given
order, into the destination array. |
static byte[] |
encodeAsList(java.lang.Object... elements)
Returns the encoding of an RLP list item containing the given objects, encoded.
|
static void |
encodeAsList(java.lang.Object[] elements,
byte[] dest,
int destIndex)
Inserts the encoding of an RLP list item, containing the encoded elements of the array in the given order, into
the destination array.
|
static long |
encodedLen(long val) |
static byte[] |
encodeSequentially(java.lang.Iterable<?> objects)
Returns the concatenation of the encodings of the given objects in the given order.
|
static int |
encodeSequentially(java.lang.Iterable<?> objects,
byte[] dest,
int destIndex)
Inserts the concatenation of the encodings of the given objects in the given order into the destination array.
|
static byte[] |
encodeSequentially(java.lang.Object... objects)
Returns the concatenation of the encodings of the given objects in the given order.
|
static int |
encodeSequentially(java.lang.Object[] objects,
byte[] dest,
int destIndex)
Inserts the concatenation of the encodings of the given objects in the given order into the destination array.
|
static int |
insertListPrefix(long dataLen,
byte[] dest,
int destIndex) |
static void |
insertRecordContentList(int dataLen,
long seq,
KeyValuePair[] pairs,
byte[] record,
int offset) |
static int |
insertRecordSignature(byte[] signature,
byte[] record,
int offset) |
static int |
prefixLength(long dataLen) |
static RLPList |
toList(java.lang.Iterable<RLPItem> encodings)
Wraps n encodings in an RLPList.
|
static RLPList |
toList(RLPItem... encodings)
Wraps n encodings in an RLPList.
|
public static long encodedLen(long val)
public static long dataLen(KeyValuePair[] pairs)
public static int prefixLength(long dataLen)
public static int insertListPrefix(long dataLen,
byte[] dest,
int destIndex)
public static byte[] encode(byte b)
b - the byte to be encodedpublic static byte[] encode(byte[] byteString)
byteString - the byte string to be encodedpublic static byte[] encodeSequentially(java.lang.Object... objects)
objects - the raw objects to be encoded in sequencepublic static byte[] encodeSequentially(java.lang.Iterable<?> objects)
Iterable
containing the objects is not encoded.objects - the raw objects to be encodedpublic static int encodeSequentially(java.lang.Object[] objects,
byte[] dest,
int destIndex)
objects - the raw objects to be encodeddest - the destination for the sequence of RLP encodingsdestIndex - the index into dest for the sequencedest marking the end of the sequencepublic static int encodeSequentially(java.lang.Iterable<?> objects,
byte[] dest,
int destIndex)
Iterable containing the objects is not encoded.objects - the raw objects to be encodeddest - the destination for the sequence of RLP encodingsdestIndex - the index into the destination for the sequencepublic static byte[] encodeAsList(java.lang.Object... elements)
elements - the raw elements to be encoded as an RLP list itempublic static byte[] encodeAsList(java.lang.Iterable<?> elements)
Iterable in the
given order.elements - the raw elements to be encoded as an RLP list itempublic static void encodeAsList(java.lang.Object[] elements,
byte[] dest,
int destIndex)
elements - the raw elements to be encoded as an RLP list itemdest - the destination for the RLP encoding of the listdestIndex - the index into the destination for the listpublic static void encodeAsList(java.lang.Iterable<?> elements,
byte[] dest,
int destIndex)
Iterable in the given
order, into the destination array.elements - the raw elements to be encoded as an RLP list itemdest - the destination for the RLP encoding of the listdestIndex - the index into the destination for the listpublic static RLPList toList(RLPItem... encodings)
encodings - the RLP-encoded elements of the new RLPListpublic static RLPList toList(java.lang.Iterable<RLPItem> encodings)
encodings - the RLP-encoded elements of the new RLPListpublic static void insertRecordContentList(int dataLen,
long seq,
KeyValuePair[] pairs,
byte[] record,
int offset)
public static int insertRecordSignature(byte[] signature,
byte[] record,
int offset)