Hdf5Utils

public class Hdf5Utils

Utilities for reading/writing HDF5 files. Methods readData, writeData and writeData

Author:pipek

Methods

readFileData

public static Data readFileData(String filePath, String fileKey)

Read data from file. Up to 3-D arrays are supported. (Higher rank would require reimplementation of Data class)

Parameters:
  • filePath – Path to the file.
  • fileKey – Name of the dataset in the file.

writeData

public static void writeData(String filePath, String fileKey, Data data)

Write (from beginning) new HDF5 dataset.

Parameters:
  • filePath – Path to the file (may or may not exist).
  • fileKey – Name of the dataset (error if it exists).
  • data – Wrapped data (see class Data).

writeData

public static void writeData(String filePath, String fileKey, Data data, long[] offset)

Write (or append) data to an existing HDF5 dataset.

Parameters:
  • filePath – Path to the file.
  • fileKey – Name of the (existing) dataset.
  • data – Wrapped data (see class Data).
  • offset – Offset (in dimensions) from which start with writing data. If offset == null, new data set is created. You have to be sure that your offset is correct. The dataset is enlarged if possible but you can overwrite existing data if you are not careful.

writeData

public static void writeData(String filePath, String fileKey, int dataType, long[] dimensions, Object rawData, long[] offset)

Write data to a HDF5 dataset (generic version). This generic version is available as a public method, still it is more convenient (and practical) to use writeData(String, String, Data) or writeData.

Parameters:
  • filePath – Path to the file (may or may not exist).
  • fileKey – Name of the dataset.
  • dataType – HDF5 data type.
  • dimensions – The dimensions of the data array.
  • rawData – The data array of any format.
  • offset – Offset of data (null => create new dataset)