Class HexUtils
java.lang.Object
io.servicetalk.opentracing.internal.HexUtils
Utilities for hex strings.
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
hexBytesOfLong
(long v) Builds an hexString
that represents the providedlong
value.static long
longOfHexBytes
(String str, int offset) Retrieves thelong
value represented by the provided hexString
.static <T extends CharSequence>
TvalidateHexBytes
(T str) Checks that the providedCharSequence
is a valid hexCharSequence
, throwing anIllegalArgumentException
if it is not.
-
Method Details
-
validateHexBytes
Checks that the providedCharSequence
is a valid hexCharSequence
, throwing anIllegalArgumentException
if it is not.- Type Parameters:
T
- The type ofCharSequence
to validate.- Parameters:
str
- theCharSequence
to check.- Returns:
- the provided
CharSequence
unchanged.
-
longOfHexBytes
Retrieves thelong
value represented by the provided hexString
. ThrowsStringIndexOutOfBoundsException
if offset is invalid.- Parameters:
str
- an hexString
.offset
- The index to start withinstr
to start the conversion.- Returns:
- the
long
value.
-
hexBytesOfLong
Builds an hexString
that represents the providedlong
value.- Parameters:
v
- thelong
value.- Returns:
- an hex
String
.
-