Please, help us to better serve our user community by answering the following short survey: https://www.hdfgroup.org/website-survey/

| HDF 4.3.0 API Reference |

Loading...
Searching...
No Matches
Static Public Member Functions
HDFNativeData Class Reference

## Detailed Description

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 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.hdflib.HDFArray.

## Static Public Member Functions
static synchronized native int[] | byteToInt (byte[] data)
static synchronized native float[] | byteToFloat (byte[] data)
static synchronized native short[] | byteToShort (byte[] data)
static synchronized native long[] | byteToLong (byte[] data)
static synchronized native double[] | byteToDouble (byte[] data)
static synchronized native int[] | byteToInt (int start, int len, byte[] data)
static synchronized int | byteToInt (byte[] data, int start)
static synchronized native short[] | byteToShort (int start, int len, byte[] data)
static synchronized short | byteToShort (byte[] data, int start)
static synchronized native float[] | byteToFloat (int start, int len, byte[] data)
static synchronized float | byteToFloat (byte[] data, int start)
static synchronized native long[] | byteToLong (int start, int len, byte[] data)
static synchronized long | byteToLong (byte[] data, int start)
static synchronized native double[] | byteToDouble (int start, int len, byte[] data)
static synchronized double | byteToDouble (byte[] data, int start)
static synchronized native byte[] | intToByte (int start, int len, int[] data)
static synchronized native byte[] | shortToByte (int start, int len, short[] data)
static synchronized native byte[] | floatToByte (int start, int len, float[] data)
static synchronized native byte[] | longToByte (int start, int len, long[] data)
static synchronized native byte[] | doubleToByte (int start, int len, double[] data)
static synchronized native byte[] | byteToByte (byte data)
static synchronized byte[] | byteToByte (Byte data)
static synchronized native byte[] | intToByte (int data)
static synchronized byte[] | intToByte (Integer data)
static synchronized native byte[] | shortToByte (short data)
static synchronized byte[] | shortToByte (Short data)
static synchronized native byte[] | floatToByte (float data)
static synchronized byte[] | floatToByte (Float data)
static synchronized native byte[] | longToByte (long data)
static synchronized byte[] | longToByte (Long data)
static synchronized native byte[] | doubleToByte (double data)
static synchronized byte[] | doubleToByte (Double data)
static synchronized Object | byteToNumber (byte[] barray, Object obj) throws HDFException
static Object | defineDataObject (int dataType, int datasize)

## Member Function Documentation

## ◆ byteToByte() [1/2]

static synchronized native byte[] byteToByte | ( | byte | data | ) |
| static

Convert a single byte into an array of one byte.

(This is a trivial method.)

Parameters

  data | The input byte

Returns
  an array of bytes

## ◆ byteToByte() [2/2]

static synchronized byte[] byteToByte | ( | Byte | data | ) |
| static

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

(This is an almost trivial method.)

Parameters

  data | The input Byte

Returns
  an array of bytes

## ◆ byteToDouble() [1/3]

static synchronized native double[] byteToDouble | ( | byte[] | data | ) |
| static

Convert an array of bytes into an array of double

Parameters

  data | The input array of bytes

Returns
  an array of double

## ◆ byteToDouble() [2/3]

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

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

Returns
  The double value of the bytes.

## ◆ byteToDouble() [3/3]

static synchronized native double[] byteToDouble | ( | int | start,
|  | int | len,
|  | byte[] | data )
| static

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

Returns
  an array of 'len' double

## ◆ byteToFloat() [1/3]

static synchronized native float[] byteToFloat | ( | byte[] | data | ) |
| static

Convert an array of bytes into an array of floats

Parameters

  data | The input array of bytes

Returns
  an array of float

## ◆ byteToFloat() [2/3]

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

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

Returns
  The float value of the bytes.

## ◆ byteToFloat() [3/3]

static synchronized native float[] byteToFloat | ( | int | start,
|  | int | len,
|  | byte[] | data )
| static

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

Returns
  an array of 'len' float

## ◆ byteToInt() [1/3]

static synchronized native int[] byteToInt | ( | byte[] | data | ) |
| static

Convert an array of bytes into an array of ints

Parameters

  data | The input array of bytes

Returns
  an array of int

## ◆ byteToInt() [2/3]

static synchronized int byteToInt | ( | byte[] | data,
|  | int | start )
| static

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

Returns
  The integer value of the bytes.

## ◆ byteToInt() [3/3]

static synchronized native int[] byteToInt | ( | int | start,
|  | int | len,
|  | byte[] | data )
| static

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

Returns
  an array of 'len' int

## ◆ byteToLong() [1/3]

static synchronized native long[] byteToLong | ( | byte[] | data | ) |
| static

Convert an array of bytes into an array of long

Parameters

  data | The input array of bytes

Returns
  an array of long

## ◆ byteToLong() [2/3]

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

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

Returns
  The long value of the bytes.

## ◆ byteToLong() [3/3]

static synchronized native long[] byteToLong | ( | int | start,
|  | int | len,
|  | byte[] | data )
| static

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

Returns
  an array of 'len' long

## ◆ byteToNumber()

static synchronized Object byteToNumber | ( | byte[] | barray,
|  | Object | obj ) throws HDFException
| static

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.

Returns
  A Object of the type of obj.

Exceptions

  HDFException | Error unsupported type.

## ◆ byteToShort() [1/3]

static synchronized native short[] byteToShort | ( | byte[] | data | ) |
| static

Convert an array of bytes into an array of shorts

Parameters

  data | The input array of bytes

Returns
  an array of short

## ◆ byteToShort() [2/3]

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

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

Returns
  The short value of the bytes.

## ◆ byteToShort() [3/3]

static synchronized native short[] byteToShort | ( | int | start,
|  | int | len,
|  | byte[] | data )
| static

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

Returns
  an array of 'len' short

## ◆ defineDataObject()

static Object defineDataObject | ( | int | dataType,
|  | int | datasize )
| static

Allocate a 1D array large enough to hold a multidimensional array of 'datasize' elements of 'dataType' numbers. This is called from hdf.hdfobject.HDFGR and hdf.hdfobject.HDFSDS, and hdf.io.ASCII2HDF

Parameters

  dataType | the type of the image data
  datasize | the size of the image data array

Returns
  an array of 'datasize' numbers of 'dataType

## ◆ doubleToByte() [1/3]

static synchronized native byte[] doubleToByte | ( | double | data | ) |
| static

Convert a single double into an array of 8 bytes.

Parameters

  data | The input double

Returns
  an array of bytes

## ◆ doubleToByte() [2/3]

static synchronized byte[] doubleToByte | ( | Double | data | ) |
| static

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

Parameters

  data | The input Double

Returns
  an array of bytes

## ◆ doubleToByte() [3/3]

static synchronized native byte[] doubleToByte | ( | int | start,
|  | int | len,
|  | double[] | data )
| static

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

Returns
  an array of bytes

## ◆ floatToByte() [1/3]

static synchronized native byte[] floatToByte | ( | float | data | ) |
| static

Convert a single float into an array of 4 bytes.

Parameters

  data | The input float

Returns
  an array of bytes

## ◆ floatToByte() [2/3]

static synchronized byte[] floatToByte | ( | Float | data | ) |
| static

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

Parameters

  data | The input Float

Returns
  an array of bytes

## ◆ floatToByte() [3/3]

static synchronized native byte[] floatToByte | ( | int | start,
|  | int | len,
|  | float[] | data )
| static

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

Returns
  an array of bytes

## ◆ intToByte() [1/3]

static synchronized native byte[] intToByte | ( | int | data | ) |
| static

Convert a single int into an array of 4 bytes.

Parameters

  data | The input int

Returns
  an array of bytes

## ◆ intToByte() [2/3]

static synchronized native byte[] intToByte | ( | int | start,
|  | int | len,
|  | int[] | data )
| static

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

Returns
  an array of bytes

## ◆ intToByte() [3/3]

static synchronized byte[] intToByte | ( | Integer | data | ) |
| static

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

Parameters

  data | The input Integer

Returns
  an array of bytes

## ◆ longToByte() [1/3]

static synchronized native byte[] longToByte | ( | int | start,
|  | int | len,
|  | long[] | data )
| static

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

Returns
  an array of bytes

## ◆ longToByte() [2/3]

static synchronized native byte[] longToByte | ( | long | data | ) |
| static

Convert a single long into an array of 8 bytes.

Parameters

  data | The input long

Returns
  an array of bytes

## ◆ longToByte() [3/3]

static synchronized byte[] longToByte | ( | Long | data | ) |
| static

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

Parameters

  data | The input Long

Returns
  an array of bytes

## ◆ shortToByte() [1/3]

static synchronized native byte[] shortToByte | ( | int | start,
|  | int | len,
|  | short[] | data )
| static

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

Returns
  an array of bytes

## ◆ shortToByte() [2/3]

static synchronized native byte[] shortToByte | ( | short | data | ) |
| static

Convert a single short into an array of 2 bytes.

Parameters

  data | The input short

Returns
  an array of bytes

## ◆ shortToByte() [3/3]

static synchronized byte[] shortToByte | ( | Short | data | ) |
| static

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

Parameters

  data | The input Short

Returns
  an array of bytes

The documentation for this class was generated from the following file:

- java/src/hdf/hdflib/HDFNativeData.java