Package io.micrometer.tracing.internal
Class EncodingUtils
java.lang.Object
io.micrometer.tracing.internal.EncodingUtils
Adopted from OpenTelemetry API.
- Since:
- 1.0.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic bytebyteFromBase16String(CharSequence chars, int offset) Decodes the specified two character sequence, and returns the resultingbyte.static voidbyteToBase16(byte value, char[] dest, int destOffset) Converts the byte to base16 string.static StringfromLong(long id) Converts long into string.static StringfromLongs(long idHigh, long idLow) Converts longs into string.static long[]fromString(CharSequence chars) Returns thelongvalue.static booleanisValidBase16String(CharSequence value) Checks if string is valid base16.static longlongFromBase16String(CharSequence chars) Returns thelongvalue whose base16 representation is stored in the first 16 chars ofcharsstarting from theoffset.static voidlongToBase16String(long value, char[] dest, int destOffset) Converts the long to base16 string.
-
Method Details
-
fromString
Returns thelongvalue.- Parameters:
chars- the base8 or base16 representation of thelong- Returns:
- long array from string. Either contains high and low or just low trace id
-
fromLong
Converts long into string.- Parameters:
id- 64 bit- Returns:
- string representation of the long
-
fromLongs
Converts longs into string.- Parameters:
idHigh- - trace id high partidLow- - trace id low part- Returns:
- string representation of the long
-
longFromBase16String
Returns thelongvalue whose base16 representation is stored in the first 16 chars ofcharsstarting from theoffset.- Parameters:
chars- the base16 representation of thelong- Returns:
- long value from string
-
byteFromBase16String
Decodes the specified two character sequence, and returns the resultingbyte.- Parameters:
chars- the character sequence to be decodedoffset- the starting offset in theCharSequence.- Returns:
- the resulting
byte - Throws:
IllegalArgumentException- if the input is not a valid encoded string according to this encoding
-
isValidBase16String
Checks if string is valid base16.- Parameters:
value- to check- Returns:
trueif valid base16 string
-
longToBase16String
public static void longToBase16String(long value, char[] dest, int destOffset) Converts the long to base16 string.- Parameters:
value- value to convertdest- destination arraydestOffset- offset
-
byteToBase16
public static void byteToBase16(byte value, char[] dest, int destOffset) Converts the byte to base16 string.- Parameters:
value- value to convertdest- destination arraydestOffset- offset
-