HDF: HDFArray Class Reference

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

| HDF 4.4.0 API Reference |

Loading...
Searching...
No Matches
HDFArray Class Reference

## Detailed Description

This is a class for handling multidimensional arrays for HDF.

The purpose is to allow the storage and retrieval of arbitrary array types containing scientific data.

The methods support the conversion of an array to and from Java to a one-dimensional array of bytes suitable for I/O by the C library.

This class heavily uses the HDFNativeData class to convert between Java and C representations.

## Public Member Functions
| HDFArray (Object anArray) throws HDFJavaException
byte[] | emptyBytes () throws HDFJavaException
byte[] | byteify () throws HDFJavaException
Object | arrayify (byte[] bytes) throws HDFJavaException

## Constructor & Destructor Documentation

## ◆ HDFArray()

HDFArray | ( | Object | anArray | ) | throws HDFJavaException

The input must be a Java Array (possibly multidimensional) of primitive numbers or sub-classes of Number.

The input is analysed to determine the number of dimensions and size of each dimension, as well as the type of the elements.

The description is saved in private variables, and used to convert data.

Parameters

  anArray | The array object.

Exceptions

  hdf.hdflib.HDFJavaException | object is not an array.

## Member Function Documentation

## ◆ arrayify()

Object arrayify | ( | byte[] | bytes | ) | throws HDFJavaException

Given a one-dimensional array of bytes representing numbers, convert it to a java array of the shape and size passed to the constructor.

Parameters

  bytes | The bytes to construct the Array.

Returns
  An Array (possibly multidimensional) of primitive or number objects.

Exceptions

  hdf.hdflib.HDFJavaException | the object not an array or other internal error.

## ◆ byteify()

byte[] byteify | ( |  | ) | throws HDFJavaException

Given a Java array of numbers, convert it to a one-dimensional array of bytes in correct native order.

Returns
  A one-D array of bytes, constructed from the Array passed to the constructor.

Exceptions

  hdf.hdflib.HDFJavaException | the object not an array or other internal error.

## ◆ emptyBytes()

byte[] emptyBytes | ( |  | ) | throws HDFJavaException

Allocate a one-dimensional array of bytes sufficient to store the array.

Returns
  A one-D array of bytes, filled with zeroes. The bytes are sufficient to hold the data of the Array passed to the constructor.

Exceptions

  hdf.hdflib.HDFJavaException | Allocation failed.

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

- java/src/hdf/hdflib/HDFArray.java