Top Description Fields Constructors Methods
io.opentelemetry.api.internal

public final Class OtelEncodingUtils

extends Object
Class Inheritance
Annotations
@Immutable
Imports
java.util.Arrays, javax.annotation.concurrent.Immutable

This class is internal and is hence not for public use. Its APIs are unstable and can change at any time.

Field Summary

Modifier and TypeField and Description
private static final String
pack-priv static final int
private static final byte[]
private static final char[]
pack-priv static final int
pack-priv static final int
private static final int
private static final boolean[]

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static byte[]
private static char[]
private static boolean[]
public static byte

Returns:

the resulting byte
byteFromBase16
(char
the first hex character.
first
,
char
the second hex character.
second
)

Decodes the specified two character sequence, and returns the resulting byte.

public static byte[]
bytesFromBase16(CharSequence value, int length)

Returns the byte[] decoded from the given hex CharSequence.

public static void
bytesFromBase16(CharSequence value, int length, byte[] bytes)

Fills bytes with bytes decoded from the given hex CharSequence.

public static void
bytesToBase16(byte[] bytes, char[] dest, int length)

Fills dest with the hex encoding of bytes.

public static void
byteToBase16(byte
the value to be converted.
value
,
char[]
the destination char array.
dest
,
int
the starting offset in the destination char array.
destOffset
)

Encodes the specified byte, and returns the encoded String.

public static boolean
isValidBase16Character(char b)

Returns whether the given char is a valid hex character.

public static boolean
isValidBase16String(CharSequence value)

Returns whether the CharSequence is a valid hex string.

public static long
longFromBase16String(CharSequence
the base16 representation of the long.
chars
,
int
the starting offset in the CharSequence.
offset
)

Returns the long value whose base16 representation is stored in the first 16 chars of chars starting from the offset.

public static void
longToBase16String(long
the value to be converted.
value
,
char[]
the destination char array.
dest
,
int
the starting offset in the destination char array.
destOffset
)

Appends the base16 encoding of the specified value to the dest.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ALPHABETback to summary
private static final String ALPHABET
BYTE_BASE16back to summary
pack-priv static final int BYTE_BASE16
DECODINGback to summary
private static final byte[] DECODING
ENCODINGback to summary
private static final char[] ENCODING
LONG_BASE16back to summary
pack-priv static final int LONG_BASE16
LONG_BYTESback to summary
pack-priv static final int LONG_BYTES
NUM_ASCII_CHARACTERSback to summary
private static final int NUM_ASCII_CHARACTERS
VALID_HEXback to summary
private static final boolean[] VALID_HEX

Constructor Detail

OtelEncodingUtilsback to summary
private OtelEncodingUtils()

Method Detail

buildDecodingArrayback to summary
private static byte[] buildDecodingArray()
buildEncodingArrayback to summary
private static char[] buildEncodingArray()
buildValidHexArrayback to summary
private static boolean[] buildValidHexArray()
byteFromBase16back to summary
public static byte byteFromBase16(char first, char second)

Decodes the specified two character sequence, and returns the resulting byte.

Parameters
first:char

the first hex character.

second:char

the second hex character.

Returns:byte

the resulting byte

bytesFromBase16back to summary
public static byte[] bytesFromBase16(CharSequence value, int length)

Returns the byte[] decoded from the given hex CharSequence.

bytesFromBase16back to summary
public static void bytesFromBase16(CharSequence value, int length, byte[] bytes)

Fills bytes with bytes decoded from the given hex CharSequence.

bytesToBase16back to summary
public static void bytesToBase16(byte[] bytes, char[] dest, int length)

Fills dest with the hex encoding of bytes.

byteToBase16back to summary
public static void byteToBase16(byte value, char[] dest, int destOffset)

Encodes the specified byte, and returns the encoded String.

Parameters
value:byte

the value to be converted.

dest:char[]

the destination char array.

destOffset:int

the starting offset in the destination char array.

isValidBase16Characterback to summary
public static boolean isValidBase16Character(char b)

Returns whether the given char is a valid hex character.

isValidBase16Stringback to summary
public static boolean isValidBase16String(CharSequence value)

Returns whether the CharSequence is a valid hex string.

longFromBase16Stringback to summary
public static long longFromBase16String(CharSequence chars, int offset)

Returns the long value whose base16 representation is stored in the first 16 chars of chars starting from the offset.

Parameters
chars:CharSequence

the base16 representation of the long.

offset:int

the starting offset in the CharSequence.

longToBase16Stringback to summary
public static void longToBase16String(long value, char[] dest, int destOffset)

Appends the base16 encoding of the specified value to the dest.

Parameters
value:long

the value to be converted.

dest:char[]

the destination char array.

destOffset:int

the starting offset in the destination char array.