public class ByteArrayConvert extends java.lang.Object
Constructor and Description |
---|
ByteArrayConvert() |
Modifier and Type | Method and Description |
---|---|
static java.lang.Object |
byteArrayTo(byte[] in,
boolean little)
Bit transform and return the 'in' byte array in the specified data type array
|
static java.lang.Object |
byteArrayTo(byte[] in,
DataType outDataType,
boolean little)
Bit transform and return the 'in' byte array in the specified data type array
|
static java.lang.Object |
byteArrayTo(byte[] in,
int outDataType,
boolean little)
Deprecated.
use
byteArrayTo(byte[], DataType , boolean ) instead |
static java.lang.Object |
byteArrayTo(byte[] in,
int inOffset,
DataType outDataType,
int byteLength,
boolean little)
Bit transform and return the 'in' byte array in the specified data type array
|
static java.lang.Object |
byteArrayTo(byte[] in,
int inOffset,
int inStep,
DataType outDataType,
int outOffset,
int outStep,
int byteLength,
boolean little)
Bit transform and return the 'in' byte array in the specified data type array
|
static java.lang.Object |
byteArrayTo(byte[] in,
int inOffset,
int outDataType,
int byteLength,
boolean little)
Deprecated.
|
static java.lang.Object |
byteArrayTo(byte[] in,
int inOffset,
int inStep,
int outDataType,
int outOffset,
int outStep,
int byteLength,
boolean little)
Deprecated.
|
static java.lang.Object |
byteArrayTo(byte[] in,
int inOffset,
int inStep,
java.lang.Object out,
boolean little)
Bit transform and return the 'in' byte array in the specified data type array
|
static java.lang.Object |
byteArrayTo(byte[] in,
int inOffset,
int inStep,
java.lang.Object out,
int outOffset,
int outStep,
int byteLength,
boolean little)
Bit transform and return the 'in' byte array in the specified data type array
|
static java.lang.Object |
byteArrayTo(byte[] in,
int inOffset,
java.lang.Object out,
int outOffset,
int byteLength,
boolean little)
Bit transform and return the 'in' byte array in the specified data type array
|
static java.lang.Object |
byteArrayTo(byte[] in,
java.lang.Object out,
boolean little)
Bit transform and return the 'in' byte array in the specified 'out' data type array
|
static byte[] |
byteArrayToByteArray(byte[] in)
Bit transform and return the 'in' byte array in the specified data type array
|
static byte[] |
byteArrayToByteArray(byte[] in,
byte[] out)
Bit transform and return the 'in' byte array in the specified data type array
|
static byte[] |
byteArrayToByteArray(byte[] in,
int inOffset,
byte[] out,
int outOffset,
int byteLength)
Bit transform and return the 'in' byte array in the specified data type array
|
static byte[] |
byteArrayToByteArray(byte[] in,
int inOffset,
int inStep,
byte[] out,
int outOffset,
int outStep,
int byteLength)
Bit transform and return the 'in' byte array in the specified data type array
|
static double[] |
byteArrayToDoubleArray(byte[] in,
boolean little)
Bit transform and return the 'in' byte array in the specified data type array
|
static double[] |
byteArrayToDoubleArray(byte[] in,
double[] out,
boolean little)
Bit transform and return the 'in' byte array in the specified data type array
|
static double[] |
byteArrayToDoubleArray(byte[] in,
int inOffset,
double[] out,
int outOffset,
int byteLength,
boolean little)
Bit transform and return the 'in' byte array in the specified data type array
|
static double[] |
byteArrayToDoubleArray(byte[] in,
int inOffset,
int inStep,
double[] out,
int outOffset,
int outStep,
int byteLength,
boolean little)
Bit transform and return the 'in' byte array in 'out' double array
|
static float[] |
byteArrayToFloatArray(byte[] in,
boolean little)
Bit transform and return the 'in' byte array in the specified data type array
|
static float[] |
byteArrayToFloatArray(byte[] in,
float[] out,
boolean little)
Bit transform and return the 'in' byte array in the specified data type array
|
static float[] |
byteArrayToFloatArray(byte[] in,
int inOffset,
float[] out,
int outOffset,
int byteLength,
boolean little)
Bit transform and return the 'in' byte array in the specified data type array
|
static float[] |
byteArrayToFloatArray(byte[] in,
int inOffset,
int inStep,
float[] out,
int outOffset,
int outStep,
int byteLength,
boolean little)
Bit transform and return the 'in' byte array in 'out' float array
|
static int[] |
byteArrayToIntArray(byte[] in,
boolean little)
Bit transform and return the 'in' byte array in the specified data type array
|
static int[] |
byteArrayToIntArray(byte[] in,
int[] out,
boolean little)
Bit transform and return the 'in' byte array in the specified data type array
|
static int[] |
byteArrayToIntArray(byte[] in,
int inOffset,
int[] out,
int outOffset,
int byteLength,
boolean little)
Bit transform and return the 'in' byte array in the specified data type array
|
static int[] |
byteArrayToIntArray(byte[] in,
int inOffset,
int inStep,
int[] out,
int outOffset,
int outStep,
int byteLength,
boolean little)
Bit transform and return the 'in' byte array in 'out' int array
|
static long[] |
byteArrayToLongArray(byte[] in,
boolean little)
Bit transform and return the 'in' byte array in the specified data type array
|
static long[] |
byteArrayToLongArray(byte[] in,
int inOffset,
int inStep,
long[] out,
int outOffset,
int outStep,
int byteLength,
boolean little)
Bit transform and return the 'in' byte array in 'out' long array
|
static long[] |
byteArrayToLongArray(byte[] in,
int inOffset,
long[] out,
int outOffset,
int byteLength,
boolean little)
Bit transform and return the 'in' byte array in the specified data type array
|
static long[] |
byteArrayToLongArray(byte[] in,
long[] out,
boolean little)
Bit transform and return the 'in' byte array in the specified data type array
|
static short[] |
byteArrayToShortArray(byte[] in,
boolean little)
Bit transform and return the 'in' byte array in the specified data type array
|
static short[] |
byteArrayToShortArray(byte[] in,
int inOffset,
int inStep,
short[] out,
int outOffset,
int outStep,
int byteLength,
boolean little)
Bit transform and return the 'in' byte array in 'out' short array
|
static short[] |
byteArrayToShortArray(byte[] in,
int inOffset,
short[] out,
int outOffset,
int byteLength,
boolean little)
Bit transform and return the 'in' byte array in the specified data type array
|
static short[] |
byteArrayToShortArray(byte[] in,
short[] out,
boolean little)
Bit transform and return the 'in' byte array in the specified data type array
|
static byte[] |
doubleArrayToByteArray(double[] in,
int inOffset,
int inStep,
byte[] out,
int outOffset,
int outStep,
int byteLength,
boolean little)
Bit transform and return the 'in' double array as byte array
|
static byte[] |
floatArrayToByteArray(float[] in,
int inOffset,
int inStep,
byte[] out,
int outOffset,
int outStep,
int byteLength,
boolean little)
Bit transform and return the 'in' float array as byte array
|
static int |
getCopyLengthInBytes(java.lang.Object array,
int offset)
Get length in bytes for a copy from or to array with specified offset.
|
static int |
getCopyLengthInBytes(java.lang.Object array,
int offset,
int step)
Get length in bytes for a copy from or to array with specified offset and step.
|
static int |
getCopyLengthInBytes(java.lang.Object in,
int inOffset,
java.lang.Object out,
int outOffset)
Get maximum length in bytes for a copy from in to out with specified offset.
|
static byte[] |
intArrayToByteArray(int[] in,
int inOffset,
int inStep,
byte[] out,
int outOffset,
int outStep,
int byteLength,
boolean little)
Bit transform and return the 'in' int array as byte array
|
static byte[] |
longArrayToByteArray(long[] in,
int inOffset,
int inStep,
byte[] out,
int outOffset,
int outStep,
int byteLength,
boolean little)
Bit transform and return the 'in' long array as byte array
|
static byte |
readByte(byte[] array,
int offset)
Read a byte from the input byte array at specified position.
|
static double |
readDouble(byte[] array,
int offset,
boolean littleEndian)
Read a long value from the input byte array at specified position.
|
static float |
readFloat(byte[] array,
int offset,
boolean littleEndian)
Read a long value from the input byte array at specified position.
|
static int |
readInt(byte[] array,
int offset,
boolean littleEndian)
Read a int value from the input byte array at specified position.
|
static long |
readLong(byte[] array,
int offset,
boolean littleEndian)
Read a long value from the input byte array at specified position.
|
static short |
readShort(byte[] array,
int offset,
boolean littleEndian)
Read a short value from the input byte array at specified position.
|
static byte[] |
shortArrayToByteArray(short[] in,
int inOffset,
int inStep,
byte[] out,
int outOffset,
int outStep,
int byteLength,
boolean little)
Bit transform and return the 'in' short array as byte array
|
static byte[] |
toByteArray(java.lang.Object in,
boolean little)
Bit transform and return the 'in' array as byte array
|
static byte[] |
toByteArray(java.lang.Object in,
byte[] out,
boolean little)
Bit transform and return the 'in' array as byte array
|
static byte[] |
toByteArray(java.lang.Object in,
byte[] out,
int outOffset,
int outStep,
boolean little)
Bit transform and return the 'in' array as byte array
|
static byte[] |
toByteArray(java.lang.Object in,
int inOffset,
byte[] out,
int outOffset,
int byteLength,
boolean little)
Bit transform and return the 'in' array as byte array
|
static byte[] |
toByteArray(java.lang.Object in,
int inOffset,
int byteLength,
boolean little)
Bit transform and return the 'in' array as byte array
|
static byte[] |
toByteArray(java.lang.Object in,
int inOffset,
int inStep,
byte[] out,
int outOffset,
int outStep,
int byteLength,
boolean little)
Bit transform and return the 'in' array as byte array
|
static void |
writeByte(byte[] array,
int offset,
byte value)
Write a byte to the output byte array at specified position.
|
static void |
writeDouble(byte[] array,
int offset,
double value,
boolean littleEndian)
Write a double to the output byte array at specified position.
|
static void |
writeFloat(byte[] array,
int offset,
float value,
boolean littleEndian)
Write a float to the output byte array at specified position.
|
static void |
writeInt(byte[] array,
int offset,
int value,
boolean littleEndian)
Write a int to the output byte array at specified position.
|
static void |
writeLong(byte[] array,
int offset,
long value,
boolean littleEndian)
Write a long to the output byte array at specified position.
|
static void |
writeShort(byte[] array,
int offset,
short value,
boolean littleEndian)
Write a short to the output byte array at specified position.
|
public ByteArrayConvert()
public static int getCopyLengthInBytes(java.lang.Object in, int inOffset, java.lang.Object out, int outOffset)
public static int getCopyLengthInBytes(java.lang.Object array, int offset, int step)
public static int getCopyLengthInBytes(java.lang.Object array, int offset)
public static byte readByte(byte[] array, int offset)
public static short readShort(byte[] array, int offset, boolean littleEndian)
public static int readInt(byte[] array, int offset, boolean littleEndian)
public static long readLong(byte[] array, int offset, boolean littleEndian)
public static float readFloat(byte[] array, int offset, boolean littleEndian)
public static double readDouble(byte[] array, int offset, boolean littleEndian)
public static void writeByte(byte[] array, int offset, byte value)
public static void writeShort(byte[] array, int offset, short value, boolean littleEndian)
public static void writeInt(byte[] array, int offset, int value, boolean littleEndian)
public static void writeLong(byte[] array, int offset, long value, boolean littleEndian)
public static void writeFloat(byte[] array, int offset, float value, boolean littleEndian)
public static void writeDouble(byte[] array, int offset, double value, boolean littleEndian)
public static byte[] byteArrayToByteArray(byte[] in, int inOffset, int inStep, byte[] out, int outOffset, int outStep, int byteLength)
in
- input arrayinOffset
- position where we start read data frominStep
- input offset increment step (given in output type unit)out
- output array which is used to receive result (and so define wanted type)outOffset
- position where we start to write data tooutStep
- output offset increment stepbyteLength
- number of bytes to compute (-1 means we will use the maximum possible)public static byte[] byteArrayToByteArray(byte[] in, int inOffset, byte[] out, int outOffset, int byteLength)
in
- input arrayinOffset
- position where we start read data fromout
- output array which is used to receive result (and so define wanted type)outOffset
- position where we start to write data tobyteLength
- number of bytes to compute (-1 means we will use the maximum possible)public static byte[] byteArrayToByteArray(byte[] in, byte[] out)
in
- input arrayout
- output array which is used to receive result (and so define wanted type)public static byte[] byteArrayToByteArray(byte[] in)
in
- input arraypublic static short[] byteArrayToShortArray(byte[] in, int inOffset, int inStep, short[] out, int outOffset, int outStep, int byteLength, boolean little)
in
- input arrayinOffset
- position where we start read data frominStep
- input offset increment step (given in output type unit)out
- output array which is used to receive result (and so define wanted type)outOffset
- position where we start to write data tooutStep
- output offset increment stepbyteLength
- number of bytes to compute (-1 means we will use the maximum possible)little
- little endian orderpublic static short[] byteArrayToShortArray(byte[] in, int inOffset, short[] out, int outOffset, int byteLength, boolean little)
in
- input arrayinOffset
- position where we start read data fromout
- output array which is used to receive result (and so define wanted type)outOffset
- position where we start to write data tobyteLength
- number of bytes to compute (-1 means we will use the maximum possible)little
- little endian orderpublic static short[] byteArrayToShortArray(byte[] in, short[] out, boolean little)
in
- input arrayout
- output array which is used to receive result (and so define wanted type)little
- little endian orderpublic static short[] byteArrayToShortArray(byte[] in, boolean little)
in
- input arraylittle
- little endian orderpublic static int[] byteArrayToIntArray(byte[] in, int inOffset, int inStep, int[] out, int outOffset, int outStep, int byteLength, boolean little)
in
- input arrayinOffset
- position where we start read data frominStep
- input offset increment step (given in output type unit)out
- output array which is used to receive result (and so define wanted type)outOffset
- position where we start to write data tooutStep
- output offset increment stepbyteLength
- number of bytes to compute (-1 means we will use the maximum possible)little
- little endian orderpublic static int[] byteArrayToIntArray(byte[] in, int inOffset, int[] out, int outOffset, int byteLength, boolean little)
in
- input arrayinOffset
- position where we start read data fromout
- output array which is used to receive result (and so define wanted type)outOffset
- position where we start to write data tobyteLength
- number of bytes to compute (-1 means we will use the maximum possible)little
- little endian orderpublic static int[] byteArrayToIntArray(byte[] in, int[] out, boolean little)
in
- input arrayout
- output array which is used to receive result (and so define wanted type)little
- little endian orderpublic static int[] byteArrayToIntArray(byte[] in, boolean little)
in
- input arraylittle
- little endian orderpublic static long[] byteArrayToLongArray(byte[] in, int inOffset, int inStep, long[] out, int outOffset, int outStep, int byteLength, boolean little)
in
- input arrayinOffset
- position where we start read data frominStep
- input offset increment step (given in output type unit)out
- output array which is used to receive result (and so define wanted type)outOffset
- position where we start to write data tooutStep
- output offset increment stepbyteLength
- number of bytes to compute (-1 means we will use the maximum possible)little
- little endian orderpublic static long[] byteArrayToLongArray(byte[] in, int inOffset, long[] out, int outOffset, int byteLength, boolean little)
in
- input arrayinOffset
- position where we start read data fromout
- output array which is used to receive result (and so define wanted type)outOffset
- position where we start to write data tobyteLength
- number of bytes to compute (-1 means we will use the maximum possible)little
- little endian orderpublic static long[] byteArrayToLongArray(byte[] in, long[] out, boolean little)
in
- input arrayout
- output array which is used to receive result (and so define wanted type)little
- little endian orderpublic static long[] byteArrayToLongArray(byte[] in, boolean little)
in
- input arraylittle
- little endian orderpublic static float[] byteArrayToFloatArray(byte[] in, int inOffset, int inStep, float[] out, int outOffset, int outStep, int byteLength, boolean little)
in
- input arrayinOffset
- position where we start read data frominStep
- input offset increment step (given in output type unit)out
- output array which is used to receive result (and so define wanted type)outOffset
- position where we start to write data tooutStep
- output offset increment stepbyteLength
- number of bytes to compute (-1 means we will use the maximum possible)little
- little endian orderpublic static float[] byteArrayToFloatArray(byte[] in, int inOffset, float[] out, int outOffset, int byteLength, boolean little)
in
- input arrayinOffset
- position where we start read data fromout
- output array which is used to receive result (and so define wanted type)outOffset
- position where we start to write data tobyteLength
- number of bytes to compute (-1 means we will use the maximum possible)little
- little endian orderpublic static float[] byteArrayToFloatArray(byte[] in, float[] out, boolean little)
in
- input arrayout
- output array which is used to receive result (and so define wanted type)little
- little endian orderpublic static float[] byteArrayToFloatArray(byte[] in, boolean little)
in
- input arraylittle
- little endian orderpublic static double[] byteArrayToDoubleArray(byte[] in, int inOffset, int inStep, double[] out, int outOffset, int outStep, int byteLength, boolean little)
in
- input arrayinOffset
- position where we start read data frominStep
- input offset increment step (given in output type unit)out
- output array which is used to receive result (and so define wanted type)outOffset
- position where we start to write data tooutStep
- output offset increment stepbyteLength
- number of bytes to compute (-1 means we will use the maximum possible)little
- little endian orderpublic static double[] byteArrayToDoubleArray(byte[] in, int inOffset, double[] out, int outOffset, int byteLength, boolean little)
in
- input arrayinOffset
- position where we start read data fromout
- output array which is used to receive result (and so define wanted type)outOffset
- position where we start to write data tobyteLength
- number of bytes to compute (-1 means we will use the maximum possible)little
- little endian orderpublic static double[] byteArrayToDoubleArray(byte[] in, double[] out, boolean little)
in
- input arrayout
- output array which is used to receive result (and so define wanted type)little
- little endian orderpublic static double[] byteArrayToDoubleArray(byte[] in, boolean little)
in
- input arraylittle
- little endian orderpublic static byte[] shortArrayToByteArray(short[] in, int inOffset, int inStep, byte[] out, int outOffset, int outStep, int byteLength, boolean little)
in
- input arrayinOffset
- position where we start read data frominStep
- input offset increment stepout
- output byte array which is used to receive resultoutOffset
- position where we start to write data tooutStep
- output offset increment step (given in input type unit)byteLength
- number of bytes to compute (-1 means we will use the maximum possible)little
- little endian orderpublic static byte[] intArrayToByteArray(int[] in, int inOffset, int inStep, byte[] out, int outOffset, int outStep, int byteLength, boolean little)
in
- input arrayinOffset
- position where we start read data frominStep
- input offset increment stepout
- output byte array which is used to receive resultoutOffset
- position where we start to write data tooutStep
- output offset increment step (given in input type unit)byteLength
- number of bytes to compute (-1 means we will use the maximum possible)little
- little endian orderpublic static byte[] longArrayToByteArray(long[] in, int inOffset, int inStep, byte[] out, int outOffset, int outStep, int byteLength, boolean little)
in
- input arrayinOffset
- position where we start read data frominStep
- input offset increment stepout
- output byte array which is used to receive resultoutOffset
- position where we start to write data tooutStep
- output offset increment step (given in input type unit)byteLength
- number of bytes to compute (-1 means we will use the maximum possible)little
- little endian orderpublic static byte[] floatArrayToByteArray(float[] in, int inOffset, int inStep, byte[] out, int outOffset, int outStep, int byteLength, boolean little)
in
- input arrayinOffset
- position where we start read data frominStep
- input offset increment stepout
- output byte array which is used to receive resultoutOffset
- position where we start to write data tooutStep
- output offset increment step (given in input type unit)byteLength
- number of bytes to compute (-1 means we will use the maximum possible)little
- little endian orderpublic static byte[] doubleArrayToByteArray(double[] in, int inOffset, int inStep, byte[] out, int outOffset, int outStep, int byteLength, boolean little)
in
- input arrayinOffset
- position where we start read data frominStep
- input offset increment stepout
- output byte array which is used to receive resultoutOffset
- position where we start to write data tooutStep
- output offset increment step (given in input type unit)byteLength
- number of bytes to compute (-1 means we will use the maximum possible)little
- little endian orderpublic static java.lang.Object byteArrayTo(byte[] in, int inOffset, int inStep, java.lang.Object out, int outOffset, int outStep, int byteLength, boolean little)
in
- input arrayinOffset
- position where we start read data frominStep
- input offset increment step (given in output type unit)out
- output array which is used to receive result (and so define wanted type)outOffset
- position where we start to write data tooutStep
- output offset increment stepbyteLength
- number of bytes to compute (-1 means we will use the maximum possible)little
- little endian orderpublic static java.lang.Object byteArrayTo(byte[] in, int inOffset, int inStep, java.lang.Object out, boolean little)
in
- input arrayinOffset
- position where we start read data frominStep
- input offset increment step (given in output type unit)out
- output array which is used to receive result (and so define wanted type)little
- little endian orderpublic static java.lang.Object byteArrayTo(byte[] in, int inOffset, java.lang.Object out, int outOffset, int byteLength, boolean little)
in
- input arrayinOffset
- position where we start read data fromout
- output array which is used to receive result (and so define wanted type)outOffset
- position where we start to write data tobyteLength
- number of bytes to compute (-1 means we will use the maximum possible)little
- little endian orderpublic static java.lang.Object byteArrayTo(byte[] in, java.lang.Object out, boolean little)
in
- input arrayout
- output array which is used to receive result (and so define wanted type)little
- little endian orderpublic static java.lang.Object byteArrayTo(byte[] in, boolean little)
in
- input arraylittle
- little endian orderpublic static java.lang.Object byteArrayTo(byte[] in, int inOffset, int inStep, DataType outDataType, int outOffset, int outStep, int byteLength, boolean little)
in
- input arrayinOffset
- position where we start read data frominStep
- input offset increment step (given in output type unit)outDataType
- wanted output array data typeoutOffset
- position where we start to write data tooutStep
- output offset increment stepbyteLength
- number of bytes to compute (-1 means we will use the maximum possible)little
- little endian orderpublic static java.lang.Object byteArrayTo(byte[] in, int inOffset, DataType outDataType, int byteLength, boolean little)
in
- input arrayinOffset
- position where we start read data fromoutDataType
- wanted output array data typebyteLength
- number of bytes to compute (-1 means we will use the maximum possible)little
- little endian orderpublic static java.lang.Object byteArrayTo(byte[] in, DataType outDataType, boolean little)
in
- input arrayoutDataType
- wanted output array data typelittle
- little endian order@Deprecated public static java.lang.Object byteArrayTo(byte[] in, int inOffset, int inStep, int outDataType, int outOffset, int outStep, int byteLength, boolean little)
byteArrayTo(byte[], int, int, DataType, int , int ,int , boolean)
instead@Deprecated public static java.lang.Object byteArrayTo(byte[] in, int inOffset, int outDataType, int byteLength, boolean little)
byteArrayTo(byte[], int , DataType , int , boolean )
instead@Deprecated public static java.lang.Object byteArrayTo(byte[] in, int outDataType, boolean little)
byteArrayTo(byte[], DataType , boolean )
insteadpublic static byte[] toByteArray(java.lang.Object in, int inOffset, int inStep, byte[] out, int outOffset, int outStep, int byteLength, boolean little)
in
- input array (define input type)inOffset
- position where we start read data frominStep
- input offset increment stepout
- output byte array which is used to receive resultoutOffset
- position where we start to write data tooutStep
- output offset increment step (given in input type unit)byteLength
- number of bytes to compute (-1 means we will use the maximum possible)little
- little endian orderpublic static byte[] toByteArray(java.lang.Object in, int inOffset, byte[] out, int outOffset, int byteLength, boolean little)
in
- input array (define input type)inOffset
- position where we start read data fromout
- output byte array which is used to receive resultoutOffset
- position where we start to write data tobyteLength
- number of bytes to compute (-1 means we will use the maximum possible)little
- little endian orderpublic static byte[] toByteArray(java.lang.Object in, byte[] out, int outOffset, int outStep, boolean little)
in
- input array (define input type)out
- output byte array which is used to receive resultoutOffset
- position where we start to write data tooutStep
- output offset increment step (given in input type unit)little
- little endian orderpublic static byte[] toByteArray(java.lang.Object in, int inOffset, int byteLength, boolean little)
in
- input array (define input type)inOffset
- position where we start read data frombyteLength
- number of bytes to compute (-1 means we will use the maximum possible)little
- little endian orderpublic static byte[] toByteArray(java.lang.Object in, byte[] out, boolean little)
in
- input array (define input type)out
- output byte array which is used to receive resultlittle
- little endian orderpublic static byte[] toByteArray(java.lang.Object in, boolean little)
in
- input array (define input type)little
- little endian order