public class HDFNativeData
extends java.lang.Object
These routines are used by class HDFArray to pass data to and from the HDF-5 library.
Methods xxxToByte() convert a Java array of primitive numbers (int, short, ...) to a Java array of bytes. Methods byteToXxx() convert from a Java array of bytes into a Java array of primitive numbers (int, short, ...)
Variant interfaces convert a section of an array, and also can convert to sub-classes of Java Number.
See also: hdf.hdf5lib.HDFArray.
Constructor and Description |
---|
HDFNativeData() |
Modifier and Type | Method and Description |
---|---|
static byte[] |
byteToByte(byte data)
Convert a single byte into an array of one byte.
|
static byte[] |
byteToByte(java.lang.Byte data)
Convert a single Byte object into an array of one byte.
|
static double[] |
byteToDouble(byte[] data)
Convert an array of bytes into an array of double
|
static double |
byteToDouble(byte[] data,
int start)
Convert 8 bytes from an array of bytes into a single double
|
static double[] |
byteToDouble(int start,
int len,
byte[] data)
Convert a range from an array of bytes into an array of double
|
static float[] |
byteToFloat(byte[] data)
Convert an array of bytes into an array of floats
|
static float |
byteToFloat(byte[] data,
int start)
Convert 4 bytes from an array of bytes into a single float
|
static float[] |
byteToFloat(int start,
int len,
byte[] data)
Convert a range from an array of bytes into an array of float
|
static int[] |
byteToInt(byte[] data)
Convert an array of bytes into an array of ints
|
static int |
byteToInt(byte[] data,
int start)
Convert 4 bytes from an array of bytes into a single int
|
static int[] |
byteToInt(int start,
int len,
byte[] data)
Convert a range from an array of bytes into an array of int
|
static long[] |
byteToLong(byte[] data)
Convert an array of bytes into an array of long
|
static long |
byteToLong(byte[] data,
int start)
Convert 8 bytes from an array of bytes into a single long
|
static long[] |
byteToLong(int start,
int len,
byte[] data)
Convert a range from an array of bytes into an array of long
|
static java.lang.Object |
byteToNumber(byte[] barray,
java.lang.Object obj)
Create a Number object from an array of bytes.
|
static short[] |
byteToShort(byte[] data)
Convert an array of bytes into an array of shorts
|
static short |
byteToShort(byte[] data,
int start)
Convert 2 bytes from an array of bytes into a single short
|
static short[] |
byteToShort(int start,
int len,
byte[] data)
Convert a range from an array of bytes into an array of short
|
static byte[] |
doubleToByte(double data)
Convert a single double into an array of 8 bytes.
|
static byte[] |
doubleToByte(java.lang.Double data)
Convert a single Double object into an array of 8 bytes.
|
static byte[] |
doubleToByte(int start,
int len,
double[] data)
Convert a range from an array of double into an array of bytes.
|
static byte[] |
floatToByte(float data)
Convert a single float into an array of 4 bytes.
|
static byte[] |
floatToByte(java.lang.Float data)
Convert a single Float object into an array of 4 bytes.
|
static byte[] |
floatToByte(int start,
int len,
float[] data)
Convert a range from an array of float into an array of bytes.
|
static byte[] |
intToByte(int data)
Convert a single int into an array of 4 bytes.
|
static byte[] |
intToByte(java.lang.Integer data)
Convert a single Integer object into an array of 4 bytes.
|
static byte[] |
intToByte(int start,
int len,
int[] data)
Convert a range from an array of int into an array of bytes.
|
static byte[] |
longToByte(int start,
int len,
long[] data)
Convert a range from an array of long into an array of bytes.
|
static byte[] |
longToByte(long data)
Convert a single long into an array of 8 bytes.
|
static byte[] |
longToByte(java.lang.Long data)
Convert a single Long object into an array of 8 bytes.
|
static byte[] |
shortToByte(int start,
int len,
short[] data)
Convert a range from an array of short into an array of bytes.
|
static byte[] |
shortToByte(short data)
Convert a single short into an array of 2 bytes.
|
static byte[] |
shortToByte(java.lang.Short data)
Convert a single Short object into an array of 2 bytes.
|
public static int[] byteToInt(byte[] data)
data
- The input array of bytespublic static float[] byteToFloat(byte[] data)
data
- The input array of bytespublic static short[] byteToShort(byte[] data)
data
- The input array of bytespublic static long[] byteToLong(byte[] data)
data
- The input array of bytespublic static double[] byteToDouble(byte[] data)
data
- The input array of bytespublic static int[] byteToInt(int start, int len, byte[] data)
start
- The position in the input array of bytes to startlen
- The number of 'int' to convertdata
- The input array of bytespublic static int byteToInt(byte[] data, int start)
start
- The position in the input array of bytes to startdata
- The input array of bytespublic static short[] byteToShort(int start, int len, byte[] data)
start
- The position in the input array of bytes to startlen
- The number of 'short' to convertdata
- The input array of bytespublic static short byteToShort(byte[] data, int start)
start
- The position in the input array of bytes to startdata
- The input array of bytespublic static float[] byteToFloat(int start, int len, byte[] data)
start
- The position in the input array of bytes to startlen
- The number of 'float' to convertdata
- The input array of bytespublic static float byteToFloat(byte[] data, int start)
start
- The position in the input array of bytes to startdata
- The input array of bytespublic static long[] byteToLong(int start, int len, byte[] data)
start
- The position in the input array of bytes to startlen
- The number of 'long' to convertdata
- The input array of bytespublic static long byteToLong(byte[] data, int start)
start
- The position in the input array of bytes to startdata
- The input array of bytespublic static double[] byteToDouble(int start, int len, byte[] data)
start
- The position in the input array of bytes to startlen
- The number of 'double' to convertdata
- The input array of bytespublic static double byteToDouble(byte[] data, int start)
start
- The position in the input array of bytes to startdata
- The input array of bytespublic static byte[] intToByte(int start, int len, int[] data)
start
- The position in the input array of int to startlen
- The number of 'int' to convertdata
- The input array of intpublic static byte[] shortToByte(int start, int len, short[] data)
start
- The position in the input array of int to startlen
- The number of 'short' to convertdata
- The input array of shortpublic static byte[] floatToByte(int start, int len, float[] data)
start
- The position in the input array of int to startlen
- The number of 'float' to convertdata
- The input array of floatpublic static byte[] longToByte(int start, int len, long[] data)
start
- The position in the input array of int to startlen
- The number of 'long' to convertdata
- The input array of longpublic static byte[] doubleToByte(int start, int len, double[] data)
start
- The position in the input array of double to startlen
- The number of 'double' to convertdata
- The input array of doublepublic static byte[] byteToByte(byte data)
(This is a trivial method.)
data
- The input bytepublic static byte[] byteToByte(java.lang.Byte data)
(This is an almost trivial method.)
data
- The input Bytepublic static byte[] intToByte(int data)
data
- The input intpublic static byte[] intToByte(java.lang.Integer data)
data
- The input Integerpublic static byte[] shortToByte(short data)
data
- The input shortpublic static byte[] shortToByte(java.lang.Short data)
data
- The input Shortpublic static byte[] floatToByte(float data)
data
- The input floatpublic static byte[] floatToByte(java.lang.Float data)
data
- The input Floatpublic static byte[] longToByte(long data)
data
- The input longpublic static byte[] longToByte(java.lang.Long data)
data
- The input Longpublic static byte[] doubleToByte(double data)
data
- The input doublepublic static byte[] doubleToByte(java.lang.Double data)
data
- The input Doublepublic static java.lang.Object byteToNumber(byte[] barray, java.lang.Object obj) throws HDF5Exception
barray
- The bytes to be convertedobj
- Input object of the desired output class. Must be a sub-class
of Number.HDF5Exception
- - Error unsupported type.