public static Bytes decodeOne(final Bytes encodedValue) {
    if (encodedValue.size() == 0) {
      throw new RLPException("Invalid empty input for RLP decoding");
    }

    final int prefix = encodedValue.get(0) & 0xFF;
    final RLPDecodingHelpers.Kind kind = RLPDecodingHelpers.Kind.of(prefix);
    if (kind.isList()) {
      throw new RLPException(format("Invalid input: value %s is an RLP list", encodedValue));
    }

    if (kind == RLPDecodingHelpers.Kind.BYTE_ELEMENT) {
      return encodedValue;
    }

    final int offset;
    final int size;
    if (kind == RLPDecodingHelpers.Kind.SHORT_ELEMENT) {
      offset = 1;
      size = prefix - 0x80;
    } else {
      final int sizeLength = prefix - 0xb7;
      if (1 + sizeLength > encodedValue.size()) {
        throw new RLPException(
            format(
                "Malformed RLP input: not enough bytes to read size of "
                    + "long item in %s: expected %d bytes but only %d",
                encodedValue, sizeLength + 1, encodedValue.size()));
      }
      offset = 1 + sizeLength;
      size = RLPDecodingHelpers.extractSize((index) -> encodedValue.get(index), 1, sizeLength);
    }
    if (offset + size != encodedValue.size()) {
      throw new RLPException(
          format(
              "Malformed RLP input: %s should be of size %d according to "
                  + "prefix byte but of size %d",
              encodedValue, offset + size, encodedValue.size()));
    }
    return encodedValue.slice(offset, size);
  }
Decodes an RLP-encoded value assuming it contains a single non-list item.

<p>This is equivalent (but possibly more efficient) to:

<pre>{@code
return input(value).readBytes();
}</pre>

<p>So note in particular that the value is decoded as is (and so not as a scalar in
particular).

@param encodedValue The encoded RLP value.
@return The single value encoded in {@code encodedValue}.
@throws RLPException if {@code encodedValue} is not a valid RLP encoding or if it does not
    contains a single non-list item.
ethereum/rlp/src/main/java/org/hyperledger/besu/ethereum/rlp/RLP.java