public Bytes encoded() {
    final int size = encodedSize();
    if (size == 0) {
      return Bytes.EMPTY;
    }

    final MutableBytes output = MutableBytes.create(size);
    writeEncoded(output);
    return output;
  }
Computes the final encoded data.

@return A value containing the data written to this output RLP-encoded.
ethereum/rlp/src/main/java/org/hyperledger/besu/ethereum/rlp/BytesValueRLPOutput.java