rlp / org.apache.tuweni.rlp / RLP / decodeToList

decodeToList

static fun decodeToList(source: Bytes, fn: BiConsumer<RLPReader, MutableList<Any>>): MutableList<Any> (source)

Read an RLP encoded list of values from a Bytes value, populating a mutable output list.

Parameters

source - The RLP encoded bytes.

fn - A function that will be provided a RLPReader.

Exceptions

InvalidRLPEncodingException - If there is an error decoding the RLP source.

InvalidRLPTypeException - If the first RLP value is not a list.

Return
The list supplied to fn.

static fun decodeToList(source: Bytes, lenient: Boolean, fn: BiConsumer<RLPReader, MutableList<Any>>): MutableList<Any> (source)

Read an RLP encoded list of values from a Bytes value, populating a mutable output list.

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.

Exceptions

InvalidRLPEncodingException - If there is an error decoding the RLP source.

InvalidRLPTypeException - If the first RLP value is not a list.

Return
The list supplied to fn.

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

Read a list of values from the RLP source, populating a list using a function interpreting each value.

Parameters

source - The RLP encoded bytes.

fn - A function creating a new element of the list for each value in the RLP list.

- The type of the list elements.

Exceptions

InvalidRLPEncodingException - If there is an error decoding the RLP source.

InvalidRLPTypeException - If the first RLP value is not a list.

Return
The list supplied to fn.

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

Read an RLP encoded list of values from a Bytes value, populating a mutable output list.

Parameters

source - The RLP encoded bytes.

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

fn - A function creating a new element of the list for each value in the RLP list.

- The type of the list elements.

Exceptions

InvalidRLPEncodingException - If there is an error decoding the RLP source.

InvalidRLPTypeException - If the first RLP value is not a list.

Return
The list supplied to fn.