Package io.opentelemetry.api.internal
Class OtelEncodingUtils
- java.lang.Object
-
- io.opentelemetry.api.internal.OtelEncodingUtils
-
@Immutable public final class OtelEncodingUtils extends java.lang.ObjectThis class is internal and is hence not for public use. Its APIs are unstable and can change at any time.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringALPHABET(package private) static intBYTE_BASE16private static byte[]DECODINGprivate static char[]ENCODING(package private) static intLONG_BASE16(package private) static intLONG_BYTESprivate static intNUM_ASCII_CHARACTERSprivate static boolean[]VALID_HEX
-
Constructor Summary
Constructors Modifier Constructor Description privateOtelEncodingUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static byte[]buildDecodingArray()private static char[]buildEncodingArray()private static boolean[]buildValidHexArray()static bytebyteFromBase16(char first, char second)Decodes the specified two character sequence, and returns the resultingbyte.static byte[]bytesFromBase16(java.lang.CharSequence value, int length)Returns thebyte[]decoded from the given hexCharSequence.static voidbytesFromBase16(java.lang.CharSequence value, int length, byte[] bytes)Fillsbyteswith bytes decoded from the given hexCharSequence.static voidbytesToBase16(byte[] bytes, char[] dest, int length)Fillsdestwith the hex encoding ofbytes.static voidbyteToBase16(byte value, char[] dest, int destOffset)Encodes the specified byte, and returns the encodedString.static booleanisValidBase16Character(char b)Returns whether the givencharis a valid hex character.static booleanisValidBase16String(java.lang.CharSequence value)Returns whether theCharSequenceis a valid hex string.static longlongFromBase16String(java.lang.CharSequence chars, int offset)Returns thelongvalue whose base16 representation is stored in the first 16 chars ofcharsstarting from theoffset.static voidlongToBase16String(long value, char[] dest, int destOffset)Appends the base16 encoding of the specifiedvalueto thedest.
-
-
-
Field Detail
-
LONG_BYTES
static final int LONG_BYTES
- See Also:
- Constant Field Values
-
BYTE_BASE16
static final int BYTE_BASE16
- See Also:
- Constant Field Values
-
LONG_BASE16
static final int LONG_BASE16
- See Also:
- Constant Field Values
-
ALPHABET
private static final java.lang.String ALPHABET
- See Also:
- Constant Field Values
-
NUM_ASCII_CHARACTERS
private static final int NUM_ASCII_CHARACTERS
- See Also:
- Constant Field Values
-
ENCODING
private static final char[] ENCODING
-
DECODING
private static final byte[] DECODING
-
VALID_HEX
private static final boolean[] VALID_HEX
-
-
Method Detail
-
buildEncodingArray
private static char[] buildEncodingArray()
-
buildDecodingArray
private static byte[] buildDecodingArray()
-
buildValidHexArray
private static boolean[] buildValidHexArray()
-
longFromBase16String
public static long longFromBase16String(java.lang.CharSequence chars, int offset)Returns thelongvalue whose base16 representation is stored in the first 16 chars ofcharsstarting 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 specifiedvalueto thedest.- Parameters:
value- the value to be converted.dest- the destination char array.destOffset- the starting offset in the destination char array.
-
bytesFromBase16
public static byte[] bytesFromBase16(java.lang.CharSequence value, int length)Returns thebyte[]decoded from the given hexCharSequence.
-
bytesFromBase16
public static void bytesFromBase16(java.lang.CharSequence value, int length, byte[] bytes)Fillsbyteswith bytes decoded from the given hexCharSequence.
-
bytesToBase16
public static void bytesToBase16(byte[] bytes, char[] dest, int length)Fillsdestwith 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
public static boolean isValidBase16String(java.lang.CharSequence value)
Returns whether theCharSequenceis a valid hex string.
-
isValidBase16Character
public static boolean isValidBase16Character(char b)
Returns whether the givencharis a valid hex character.
-
-