tuweni / org.apache.tuweni.bytes / Bytes / fromHexString

fromHexString

open static fun fromHexString(str: CharSequence!): Bytes! (source)

Parse a hexadecimal string into a Bytes value.

This method requires that str have an even length.

Parameters

str - CharSequence!: The hexadecimal string to parse, which may or may not start with "0x".

Exceptions

IllegalArgumentException - if str does not correspond to a valid hexadecimal representation, or is of an odd length.

Return
Bytes!: The value corresponding to str.

open static fun fromHexString(str: CharSequence!, destinationSize: Int): Bytes! (source)

Parse a hexadecimal string into a Bytes value.

This method requires that str have an even length.

Parameters

str - CharSequence!: The hexadecimal string to parse, which may or may not start with "0x".

destinationSize - Int: The size of the returned value, which must be big enough to hold the bytes represented by str. If it is strictly bigger those bytes from str, the returned value will be left padded with zeros.

Exceptions

IllegalArgumentException - if str does not correspond to a valid hexadecimal representation, or is of an odd length, or represents more bytes than destinationSize or destinationSize < 0.

Return
Bytes!: A value of size destinationSize corresponding to str potentially left-padded.