public class SerializationUtils
extends java.lang.Object
| 构造器和说明 |
|---|
SerializationUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static java.lang.String |
arrayToString(int[] array)
Convenience method for creating a String from an array.
|
static double[] |
castToDoubleArray(byte[] data)
Convenience method for creating a double array from a byte array.
|
static double[] |
doubleArrayFromString(java.lang.String data)
Parses and returns a double array from a Sting with an arbitrary number of doubles.
|
static java.util.List<double[]> |
readCodeBook(java.io.InputStream in)
Reads a double array per line from a text file for the use of code books for local features.
|
static byte[] |
toByteArray(double[] data)
Convenience method for creating a byte array from a double array.
|
static byte[] |
toByteArray(float[] data)
Convenience method for creating a byte array from a float array.
|
static byte[] |
toByteArray(int[] data)
Convenience method to transform an int[] array to a byte array for serialization.
|
static byte[] |
toBytes(double data)
Converts a double to a byte array with 4 elements.
|
static byte[] |
toBytes(float data)
Converts a float to a byte array with 4 elements.
|
static byte[] |
toBytes(int data)
Converts an int to a byte array with 4 elements.
|
static byte[] |
toBytes(long data)
Converts a long to a byte[] array.
|
static double |
toDouble(byte[] data)
Converts a byte array with 4 elements to a double.
|
static double[] |
toDoubleArray(byte[] data)
Convenience method for creating a double array from a byte array.
|
static double[] |
toDoubleArray(byte[] data,
int offset,
int length)
Convenience method for creating a double array from a byte array.
|
static double[] |
toDoubleArray(float[] d) |
static double[] |
toDoubleArray(int[] ints)
Create a double[] from an int[]
by patch contributed by Franz Graf, franz.graf@gmail.com |
static double[] |
toDoubleArray(java.lang.String data)
Creates a double[] array from a String.
|
static float |
toFloat(byte[] data)
Converts a byte array with 4 elements to a float.
|
static float[] |
toFloatArray(byte[] data)
Convenience method for creating a float array from a byte array.
|
static float[] |
toFloatArray(byte[] in,
int offset,
int length)
Convenience method for creating a float array from a byte array.
|
static java.lang.String |
toHex(byte[] data)
Create a hex string from an array of bytes.
|
static int |
toInt(byte[] data)
Converts a byte array with 4 elements to an int.
|
static int[] |
toIntArray(byte[] data)
Convenience method to create an int[] array from a byte[] array.
|
static int[] |
toIntArray(byte[] in,
int offset,
int length) |
static long |
toLong(byte[] data)
Converts a byte[] array with size 8 to a long.
|
static java.lang.String |
toString(byte[] data) |
static java.lang.String |
toString(double[] data)
A simple string creation method.
|
static void |
writeCodeBook(java.io.OutputStream out,
java.util.List<double[]> codeBook) |
public static int toInt(byte[] data)
data - the input byte arraytoBytes(int)public static byte[] toBytes(int data)
data - the int to converttoInt(byte[])public static byte[] toBytes(long data)
data - the long to converttoLong(byte[])public static long toLong(byte[] data)
data - the byte[] array to converttoBytes(long)public static byte[] toByteArray(int[] data)
data - the int[] to convertpublic static int[] toIntArray(byte[] data)
data - the byte[] array to decodepublic static int[] toIntArray(byte[] in,
int offset,
int length)
public static byte[] toBytes(float data)
toFloat(byte[]) to decode.data - the float to converttoFloat(byte[])public static float toFloat(byte[] data)
toBytes(float) to encode.data - the input byte arraytoBytes(float)public static byte[] toByteArray(float[] data)
data - the input float arraypublic static float[] toFloatArray(byte[] data)
data - public static float[] toFloatArray(byte[] in,
int offset,
int length)
in - offset - length - public static byte[] toBytes(double data)
toDouble(byte[]) to decode. Note that there is a loss
in precision as the double is converted to a float in the course of conversion.data - the double to converttoDouble(byte[])public static double toDouble(byte[] data)
toBytes(double) to encode. Note that there is a loss
in precision as the double is converted to a float in the course of conversion.data - the input byte arraytoBytes(double)public static byte[] toByteArray(double[] data)
data - the input float arraypublic static double[] toDoubleArray(byte[] data)
data - public static double[] castToDoubleArray(byte[] data)
data - public static double[] toDoubleArray(byte[] data,
int offset,
int length)
data - length - offset - public static java.lang.String arrayToString(int[] array)
array - public static double[] doubleArrayFromString(java.lang.String data)
data - public static double[] toDoubleArray(float[] d)
public static double[] toDoubleArray(int[] ints)
ints - the int arraypublic static double[] toDoubleArray(java.lang.String data)
toString(double[])data - public static java.lang.String toString(double[] data)
toDoubleArray(String).data - public static java.lang.String toString(byte[] data)
public static java.lang.String toHex(byte[] data)
data - public static java.util.List<double[]> readCodeBook(java.io.InputStream in)
in - the inputstream the code book is read from.public static void writeCodeBook(java.io.OutputStream out,
java.util.List<double[]> codeBook)
throws java.io.IOException
java.io.IOException