Class HexUtils
- java.lang.Object
-
- io.servicetalk.opentracing.internal.HexUtils
-
public final class HexUtils extends java.lang.Object
Utilities for hex strings.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
hexBytesOfLong(long v)
Builds an hexString
that represents the providedlong
value.static long
longOfHexBytes(java.lang.String str, int offset)
Retrieves thelong
value represented by the provided hexString
.static <T extends java.lang.CharSequence>
TvalidateHexBytes(T str)
Checks that the providedCharSequence
is a valid hexCharSequence
, throwing anIllegalArgumentException
if it is not.
-
-
-
Method Detail
-
validateHexBytes
public static <T extends java.lang.CharSequence> T validateHexBytes(T str)
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
public static long longOfHexBytes(java.lang.String str, int offset)
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
public static java.lang.String hexBytesOfLong(long v)
Builds an hexString
that represents the providedlong
value.- Parameters:
v
- thelong
value.- Returns:
- an hex
String
.
-
-