Package hdf.object.h5

Class H5ScalarAttr

Object
All Implemented Interfaces:
Attribute, DataFormat, H5Attribute, Serializable

public class H5ScalarAttr extends ScalarDS implements H5Attribute
An attribute is a (name, value) pair of metadata attached to a primary data object such as a dataset, group or named datatype. Like a dataset, an attribute has a name, datatype and dataspace. For more details on attributes, HDF5 Attributes in HDF5 User Guide The following code is an example of an attribute with 1D integer array of two elements.
 // Example of creating a new attribute
 // The name of the new attribute
 String name = "Data range";
 // Creating an unsigned 1-byte integer datatype
 Datatype type = new Datatype(Datatype.CLASS_INTEGER, // class
                              1,                      // size in bytes
                              Datatype.ORDER_LE,      // byte order
                              Datatype.SIGN_NONE);    // unsigned
 // 1-D array of size two
 long[] dims = {2};
 // The value of the attribute
 int[] value = {0, 255};
 // Create a new attribute
 Attribute dataRange = new H5ScalarAttr(name, type, dims);
 // Set the attribute value
 dataRange.setValue(value);
 // See FileFormat.writeAttribute() for how to attach an attribute to an object,
 @see hdf.object.FileFormat#writeAttribute(HObject, Attribute, boolean)
 
For an atomic datatype, the value of an Attribute will be a 1D array of integers, floats and strings.
Version:
1.0 6/15/2021
Author:
Allen Byrne
See Also: