tuweni / org.apache.tuweni.rlp / RLP / encodeTo


static fun <T : ByteBuffer!> encodeTo(buffer: T, fn: Consumer<RLPWriter!>!): T (source)

Encode values to a ByteBuffer.

Important: this method does not write any list prefix to the result. If you are writing a RLP encoded list of values, you usually want to use #encodeList(Consumer).


buffer - T: The buffer to write into, starting from its current position.

fn - Consumer<RLPWriter!>!: A consumer that will be provided with a RLPWriter that can consume values.

- The type of the buffer.


BufferOverflowException - If the writer attempts to write more than the provided buffer can hold.

ReadOnlyBufferException - If the provided buffer is read-only.

T: The buffer.