public final class ValueTrafo
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static double |
byte2double(byte[] b)
Reads 8 byte from the byte array and converts them to a double value.
|
static int |
byte2int(byte[] b)
Converts given byte array to positive int value assuming result < 2^31.
|
static long |
byte2long(byte[] b)
Converts given byte array to a long value.
|
static java.lang.String |
byte2string(byte[] b)
Converts the given byte array to a string by using the default encoding.
|
static byte[] |
double2byte(double d)
Converts the given double value to a byte array.
|
static int |
getBytesLength(long v)
Get minimum number of bytes to store the long value.
|
static byte[] |
long2byte(long v)
Converts a long value to byte array in Big Endian byte order.
|
static byte[] |
long2byte(long v,
int byteLength)
Converts a long value to byte array in Big Endian byte order, assuming the length of the resulting byte array has
been calculated before.
|
static byte[] |
string2byte(java.lang.String s)
Converts the given string to a byte array using the default encoding (utf-8).
|
public static long byte2long(byte[] b)
b - the byte array with length <= 8public static int byte2int(byte[] b)
b - the byte array with length <= 4public static byte[] long2byte(long v,
int byteLength)
v - long value.byteLength - length of resulting byte arraypublic static byte[] long2byte(long v)
v - long value.public static int getBytesLength(long v)
v - long value.public static double byte2double(byte[] b)
b - byte arraypublic static java.lang.String byte2string(byte[] b)
b - byte array.public static byte[] double2byte(double d)
d - double value.public static byte[] string2byte(java.lang.String s)
s - string value.