generated.docs.javadoc.hdf.hdf5lib.HDFArray.html Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of h5jan-core Show documentation
Show all versions of h5jan-core Show documentation
Read and write h5 files from Java, including Datasets, nD arrays and slicing.
HDFArray (h5jan API)
hdf.hdf5lib
Class HDFArray
- java.lang.Object
-
- hdf.hdf5lib.HDFArray
-
public class HDFArray
extends java.lang.Object
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.
-
-
Constructor Summary
Constructors
Constructor and Description
HDFArray(java.lang.Object anArray)
The input must be a Java Array (possibly multidimensional) of primitive
numbers or sub-classes of Number.
-
Method Summary
All Methods Instance Methods Concrete Methods
Modifier and Type
Method and Description
java.lang.Object
arrayify(byte[] bytes)
Given a one-dimensional array of bytes representing numbers, convert it
to a java array of the shape and size passed to the constructor.
byte[]
byteify()
Given a Java array of numbers, convert it to a one-dimensional array of
bytes in correct native order.
byte[]
emptyBytes()
Allocate a one-dimensional array of bytes sufficient to store the array.
-
-
Constructor Detail
-
HDFArray
public HDFArray(java.lang.Object anArray)
throws HDF5Exception
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.
- Throws:
HDF5Exception
- object is not an array.
-
Method Detail
-
emptyBytes
public byte[] emptyBytes()
throws HDF5JavaException
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.
- Throws:
HDF5JavaException
- Allocation failed.
-
byteify
public byte[] byteify()
throws HDF5JavaException
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.
- Throws:
HDF5JavaException
- the object not an array or other internal error.
-
arrayify
public java.lang.Object arrayify(byte[] bytes)
throws HDF5JavaException
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.
- Throws:
HDF5JavaException
- the object not an array or other internal error.
© 2015 - 2024 Weber Informatics LLC | Privacy Policy