Package io.opencensus.trace
Class BigendianEncoding
- java.lang.Object
-
- io.opencensus.trace.BigendianEncoding
-
final class BigendianEncoding extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringALPHABETprivate static intASCII_CHARACTERS(package private) static intBYTE_BASE16private static byte[]DECODINGprivate static char[]ENCODING(package private) static intLONG_BASE16(package private) static intLONG_BYTES
-
Constructor Summary
Constructors Modifier Constructor Description privateBigendianEncoding()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static byte[]buildDecodingArray()private static char[]buildEncodingArray()(package private) static bytebyteFromBase16String(java.lang.CharSequence chars, int offset)Decodes the specified two character sequence, and returns the resultingbyte.private static voidbyteToBase16(byte value, char[] dest, int destOffset)(package private) static voidbyteToBase16String(byte value, char[] dest, int destOffset)Encodes the specified byte, and returns the encodedString.private static bytedecodeByte(char hi, char lo)(package private) static longlongFromBase16String(java.lang.CharSequence chars, int offset)Returns thelongvalue whose base16 representation is stored in the first 16 chars ofcharsstarting from theoffset.(package private) static longlongFromByteArray(byte[] bytes, int offset)Returns thelongvalue whose big-endian representation is stored in the first 8 bytes ofbytesstarting from theoffset.(package private) static voidlongToBase16String(long value, char[] dest, int destOffset)Appends the base16 encoding of the specifiedvalueto thedest.(package private) static voidlongToByteArray(long value, byte[] dest, int destOffset)Stores the big-endian representation ofvaluein thedeststarting from thedestOffset.
-
-
-
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
-
ASCII_CHARACTERS
private static final int ASCII_CHARACTERS
- See Also:
- Constant Field Values
-
ENCODING
private static final char[] ENCODING
-
DECODING
private static final byte[] DECODING
-
-
Method Detail
-
buildEncodingArray
private static char[] buildEncodingArray()
-
buildDecodingArray
private static byte[] buildDecodingArray()
-
longFromByteArray
static long longFromByteArray(byte[] bytes, int offset)Returns thelongvalue whose big-endian representation is stored in the first 8 bytes ofbytesstarting from theoffset.- Parameters:
bytes- the byte array representation of thelong.offset- the starting offset in the byte array.- Returns:
- the
longvalue whose big-endian representation is given. - Throws:
java.lang.IllegalArgumentException- ifbyteshas fewer than 8 elements.
-
longToByteArray
static void longToByteArray(long value, byte[] dest, int destOffset)Stores the big-endian representation ofvaluein thedeststarting from thedestOffset.- Parameters:
value- the value to be converted.dest- the destination byte array.destOffset- the starting offset in the destination byte array.
-
longFromBase16String
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
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.
-
byteToBase16String
static void byteToBase16String(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.
-
byteFromBase16String
static byte byteFromBase16String(java.lang.CharSequence chars, int offset)Decodes the specified two character sequence, and returns the resultingbyte.- Parameters:
chars- the character sequence to be decoded.offset- the starting offset in theCharSequence.- Returns:
- the resulting
byte - Throws:
java.lang.IllegalArgumentException- if the input is not a valid encoded string according to this encoding.
-
decodeByte
private static byte decodeByte(char hi, char lo)
-
byteToBase16
private static void byteToBase16(byte value, char[] dest, int destOffset)
-
-