The design and class hierarchy of the HDF Object Package are described in this document.
The HDF Object Package is a Java package that provides an object-oriented interface to HDF data objects. The package offers a common API to access both HDF4 and HDF5 files.
The HDF Object Package does not provide a one-to-one mapping from Java methods to routines in the standard HDF4 and HDF5 libraries. The one-to-one mappings are provided via the HDF Java Native Interface products Java HDF Interface (JHI) and Java HDF5 Interface (JHI5). The HDF Object Package wraps these direct mappings with a higher level object model.
The HDF Object Package, hdf.object, provides classes that reflect the fundamental objects of the two HDF formats. Fundamental objects from HDF4 (group, multi-dimensional array, raster image, vdata, and annotation) and HDF5 (group and dataset) are presented as Java classes in the HDF Object Package.
There are three major advantages offered by the HDF Object Package:
- First, the package simplifies accesses to HDF files by encapsulating the details of calls to the HDF library in higher-level classes and methods. For example, the image object provides a method to read an image from an HDF5 file. This method may invoke more than ten calls to the HDF5 library to accomplish this task.
- Second, the package allows applications to make requests to access HDF files without directly linking to the HDF4 and HDF5 libraries. This capability is very useful for client-server architectures. The server machine can host the HDF files and libraries. The client application can be built using the HDF Object model and route requests to the server for access to the HDF files. The client does not need a local copy of the HDF libraries and, by virtue of being written in Java, is portable to many different platforms.
- Third, the HDF object package provides modular HDF4 and HDF5 packages. Applications can be built without requiring the HDF4 or HDF5 library. HDF4 and HDF5 objects are inherited from a common object/interface layer. Applications can be built by using only the common object/interface layer. For example, HDFView is built on the common object/interface layer. It compiles and runs without the HDF4 or HDF5 library.
The Object Package
The following diagram explains the structure of the HDF object package and how to use it. Package hdf.object contains the common object/interface. This package only defines interfaces or abstract classes for accessing HDF files. The implementation will rely on the HDF4/HDF5 object package. Application classes should only include hdf.object.
The hdf.object.h4 is an implementation of the HDF4 objects. It implements the interfaces and abstract classes defined in the hdf.object package. The HDF4 object package requires the HDF4 Java Native Interface (hdf.hdflib). Applications should not include this package so that it compiles and runs without the HDF4 library.
The hdf.object.h5 is an implementation of the HDF5 objects. It implements the interfaces and abstract classes defined in the hdf.object package. The HDF5 object package requires the HDF5 Java Native Interface (hdf.hdf5lib). Applications should not include this package so that it compiles and runs without the HDF5 library.
Figure 1. The Object Package.
The class hierarchy
The HDF Object Package implements an abstract data model, and the objects of the HDF4 and HDF5 data models are represented as instances of the abstract objects. The abstract class HObject has two fundamental abstract classes are Group and Dataset, and all HDF5 and HDF4 objects are a sub-type of one of these abstract classes.
Figure 1 shows the class hierarchy of the HDF Object Package.
The classes are explained in the Java class documents.
Figure 2. The Class Hierarchy of HDF Objects.
The current version of the HDF Object Package has the following limitations:
- HDF5 named datatypes are not supported.
- HDF5 ARRAY datatype with compound member is not supported.
- Nested compound datatype is not supported.
To obtain the HDF Object Package, download the HDFView software (which was written using the HDF Object Package).