tuweni / org.apache.tuweni.rlp / RLP / decode

decode

static fun <T : Any> decode(source: Bytes, fn: Function<RLPReader, T>): T (source)

Read and decode RLP from a Bytes value.

Important: this method does not consume any list prefix from the source data. If you are reading a RLP encoded list of values, you usually want to use #decodeList(Bytes, Function).

Parameters

source - The RLP encoded bytes.

fn - A function that will be provided a RLPReader.

- The result type of the reading function.

Return
The result from the reading function.

static fun <T : Any> decode(source: Bytes, lenient: Boolean, fn: Function<RLPReader, T>): T (source)

Read and decode RLP from a Bytes value.

Important: this method does not consume any list prefix from the source data. If you are reading a RLP encoded list of values, you usually want to use #decodeList(Bytes, Function).

Parameters

source - The RLP encoded bytes.

lenient - If false, an exception will be thrown if the value is not minimally encoded.

fn - A function that will be provided a RLPReader.

- The result type of the reading function.

Return
The result from the reading function.