## ncsa.hdf.hdf5lib
Class HDFNativeData

    java.lang.Object
      ncsa.hdf.hdf5lib.HDFNativeData

public class HDFNativeData
extends Object

This class encapsulates native methods to deal with arrays of numbers, converting from numbers to bytes and bytes to numbers.

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: ncsa.hdf.hdf5lib.HDFArray.

Constructor Summary
`HDFNativeData()`

Method Summary
`static byte[]` `byteToByte(byte data)` Convert a single byte into an array of one byte.
`static byte[]` `byteToByte(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 Object` `byteToNumber(byte[] barray, 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(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(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(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(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(Short data)` Convert a single Short object into an array of 2 bytes.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### HDFNativeData

    public HDFNativeData()

Method Detail

### byteToInt

    public static int[] byteToInt(byte[] data)

  Convert an array of bytes into an array of ints

  Parameters:
    `data` - The input array of bytes

### byteToFloat

    public static float[] byteToFloat(byte[] data)

  Convert an array of bytes into an array of floats

  Parameters:
    `data` - The input array of bytes

### byteToShort

    public static short[] byteToShort(byte[] data)

  Convert an array of bytes into an array of shorts

  Parameters:
    `data` - The input array of bytes

### byteToLong

    public static long[] byteToLong(byte[] data)

  Convert an array of bytes into an array of long

  Parameters:
    `data` - The input array of bytes

### byteToDouble

    public static double[] byteToDouble(byte[] data)

  Convert an array of bytes into an array of double

  Parameters:
    `data` - The input array of bytes

### byteToInt

    public static int[] byteToInt(int start,
                                  int len,
                                  byte[] data)

  Convert a range from an array of bytes into an array of int

  Parameters:
    `start` - The position in the input array of bytes to start
    `len` - The number of 'int' to convert
    `data` - The input array of bytes

### byteToInt

    public static int byteToInt(byte[] data,
                                int start)

  Convert 4 bytes from an array of bytes into a single int

  Parameters:
    `start` - The position in the input array of bytes to start
    `data` - The input array of bytes

### byteToShort

    public static short[] byteToShort(int start,
                                      int len,
                                      byte[] data)

  Convert a range from an array of bytes into an array of short

  Parameters:
    `start` - The position in the input array of bytes to start
    `len` - The number of 'short' to convert
    `data` - The input array of bytes

### byteToShort

    public static short byteToShort(byte[] data,
                                    int start)

  Convert 2 bytes from an array of bytes into a single short

  Parameters:
    `start` - The position in the input array of bytes to start
    `data` - The input array of bytes

### byteToFloat

    public static float[] byteToFloat(int start,
                                      int len,
                                      byte[] data)

  Convert a range from an array of bytes into an array of float

  Parameters:
    `start` - The position in the input array of bytes to start
    `len` - The number of 'float' to convert
    `data` - The input array of bytes

### byteToFloat

    public static float byteToFloat(byte[] data,
                                    int start)

  Convert 4 bytes from an array of bytes into a single float

  Parameters:
    `start` - The position in the input array of bytes to start
    `data` - The input array of bytes

### byteToLong

    public static long[] byteToLong(int start,
                                    int len,
                                    byte[] data)

  Convert a range from an array of bytes into an array of long

  Parameters:
    `start` - The position in the input array of bytes to start
    `len` - The number of 'long' to convert
    `data` - The input array of bytes

### byteToLong

    public static long byteToLong(byte[] data,
                                  int start)

  Convert 8(?) bytes from an array of bytes into a single long

  Parameters:
    `start` - The position in the input array of bytes to start
    `data` - The input array of bytes

### byteToDouble

    public static double[] byteToDouble(int start,
                                        int len,
                                        byte[] data)

  Convert a range from an array of bytes into an array of double

  Parameters:
    `start` - The position in the input array of bytes to start
    `len` - The number of 'double' to convert
    `data` - The input array of bytes

### byteToDouble

    public static double byteToDouble(byte[] data,
                                      int start)

  Convert 8 bytes from an array of bytes into a single double

  Parameters:
    `start` - The position in the input array of bytes to start
    `data` - The input array of bytes

### intToByte

    public static byte[] intToByte(int start,
                                   int len,
                                   int[] data)

  Convert a range from an array of int into an array of bytes.

  Parameters:
    `start` - The position in the input array of int to start
    `len` - The number of 'int' to convert
    `data` - The input array of int

### shortToByte

    public static byte[] shortToByte(int start,
                                     int len,
                                     short[] data)

  Convert a range from an array of short into an array of bytes.

  Parameters:
    `start` - The position in the input array of int to start
    `len` - The number of 'short' to convert
    `data` - The input array of short

### floatToByte

    public static byte[] floatToByte(int start,
                                     int len,
                                     float[] data)

  Convert a range from an array of float into an array of bytes.

  Parameters:
    `start` - The position in the input array of int to start
    `len` - The number of 'float' to convert
    `data` - The input array of float

### longToByte

    public static byte[] longToByte(int start,
                                    int len,
                                    long[] data)

  Convert a range from an array of long into an array of bytes.

  Parameters:
    `start` - The position in the input array of int to start
    `len` - The number of 'long' to convert
    `data` - The input array of long

### doubleToByte

    public static byte[] doubleToByte(int start,
                                      int len,
                                      double[] data)

  Convert a range from an array of double into an array of bytes.

  Parameters:
    `start` - The position in the input array of double to start
    `len` - The number of 'double' to convert
    `data` - The input array of double

### byteToByte

    public static byte[] byteToByte(byte data)

  Convert a single byte into an array of one byte.

  (This is a trivial method.)

  Parameters:
    `data` - The input byte

### byteToByte

    public static byte[] byteToByte(Byte data)

  Convert a single Byte object into an array of one byte.

  (This is an almost trivial method.)

  Parameters:
    `data` - The input Byte

### intToByte

    public static byte[] intToByte(int data)

  Convert a single int into an array of 4 bytes.

  Parameters:
    `data` - The input int

### intToByte

    public static byte[] intToByte(Integer data)

  Convert a single Integer object into an array of 4 bytes.

  Parameters:
    `data` - The input Integer

### shortToByte

    public static byte[] shortToByte(short data)

  Convert a single short into an array of 2 bytes.

  Parameters:
    `data` - The input short

### shortToByte

    public static byte[] shortToByte(Short data)

  Convert a single Short object into an array of 2 bytes.

  Parameters:
    `data` - The input Short

### floatToByte

    public static byte[] floatToByte(float data)

  Convert a single float into an array of 4 bytes.

  Parameters:
    `data` - The input float

### floatToByte

    public static byte[] floatToByte(Float data)

  Convert a single Float object into an array of 4 bytes.

  Parameters:
    `data` - The input Float

### longToByte

    public static byte[] longToByte(long data)

  Convert a single long into an array of 8 bytes.

  Parameters:
    `data` - The input long

### longToByte

    public static byte[] longToByte(Long data)

  Convert a single Long object into an array of 8(?) bytes.

  Parameters:
    `data` - The input Long

### doubleToByte

    public static byte[] doubleToByte(double data)

  Convert a single double into an array of 8 bytes.

  Parameters:
    `data` - The input double

### doubleToByte

    public static byte[] doubleToByte(Double data)

  Convert a single Double object into an array of 8 bytes.

  Parameters:
    `data` - The input Double

### byteToNumber

    public static Object byteToNumber(byte[] barray,
                                      Object obj)
                               throws HDF5Exception

  Create a Number object from an array of bytes.

  Parameters:
    `barray` - The bytes to be converted
    `obj` - Input object of the desired output class. Must be a sub-class of Number.
  Throws:
    `HDF5Exception`