Package io.opentelemetry.api.internal
Class OtelEncodingUtils
java.lang.Object
io.opentelemetry.api.internal.OtelEncodingUtils
This class is internal and is hence not for public use. Its APIs are unstable and can change at
any time.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String
(package private) static final int
private static final byte[]
private static final char[]
(package private) static final int
(package private) static final int
private static final int
private static final boolean[]
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static byte[]
private static char[]
private static boolean[]
static byte
byteFromBase16
(char first, char second) Decodes the specified two character sequence, and returns the resultingbyte
.static byte[]
bytesFromBase16
(CharSequence value, int length) Returns thebyte[]
decoded from the given hexCharSequence
.static void
bytesFromBase16
(CharSequence value, int length, byte[] bytes) Fillsbytes
with bytes decoded from the given hexCharSequence
.static void
bytesToBase16
(byte[] bytes, char[] dest, int length) Fillsdest
with the hex encoding ofbytes
.static void
byteToBase16
(byte value, char[] dest, int destOffset) Encodes the specified byte, and returns the encodedString
.static boolean
isValidBase16Character
(char b) Returns whether the givenchar
is a valid hex character.static boolean
isValidBase16String
(CharSequence value) Returns whether theCharSequence
is a valid hex string.static long
longFromBase16String
(CharSequence chars, int offset) Returns thelong
value whose base16 representation is stored in the first 16 chars ofchars
starting from theoffset
.static void
longToBase16String
(long value, char[] dest, int destOffset) Appends the base16 encoding of the specifiedvalue
to thedest
.
-
Field Details
-
LONG_BYTES
static final int LONG_BYTES- See Also:
-
BYTE_BASE16
static final int BYTE_BASE16- See Also:
-
LONG_BASE16
static final int LONG_BASE16- See Also:
-
ALPHABET
- See Also:
-
NUM_ASCII_CHARACTERS
private static final int NUM_ASCII_CHARACTERS- See Also:
-
ENCODING
private static final char[] ENCODING -
DECODING
private static final byte[] DECODING -
VALID_HEX
private static final boolean[] VALID_HEX
-
-
Constructor Details
-
OtelEncodingUtils
private OtelEncodingUtils()
-
-
Method Details
-
buildEncodingArray
private static char[] buildEncodingArray() -
buildDecodingArray
private static byte[] buildDecodingArray() -
buildValidHexArray
private static boolean[] buildValidHexArray() -
longFromBase16String
Returns thelong
value whose base16 representation is stored in the first 16 chars ofchars
starting from theoffset
.- Parameters:
chars
- the base16 representation of thelong
.offset
- the starting offset in theCharSequence
.
-
longToBase16String
public static void longToBase16String(long value, char[] dest, int destOffset) Appends the base16 encoding of the specifiedvalue
to thedest
.- Parameters:
value
- the value to be converted.dest
- the destination char array.destOffset
- the starting offset in the destination char array.
-
bytesFromBase16
Returns thebyte[]
decoded from the given hexCharSequence
. -
bytesFromBase16
Fillsbytes
with bytes decoded from the given hexCharSequence
. -
bytesToBase16
public static void bytesToBase16(byte[] bytes, char[] dest, int length) Fillsdest
with the hex encoding ofbytes
. -
byteToBase16
public static void byteToBase16(byte value, char[] dest, int destOffset) Encodes the specified byte, and returns the encodedString
.- Parameters:
value
- the value to be converted.dest
- the destination char array.destOffset
- the starting offset in the destination char array.
-
byteFromBase16
public static byte byteFromBase16(char first, char second) Decodes the specified two character sequence, and returns the resultingbyte
.- Parameters:
first
- the first hex character.second
- the second hex character.- Returns:
- the resulting
byte
-
isValidBase16String
Returns whether theCharSequence
is a valid hex string. -
isValidBase16Character
public static boolean isValidBase16Character(char b) Returns whether the givenchar
is a valid hex character.
-