Package hdf.object.h4

Class H4ScalarAttribute

Object
All Implemented Interfaces:
Attribute, DataFormat, Serializable

public class H4ScalarAttribute extends ScalarDS implements Attribute
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, read 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 Attribute(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 H4ScalarAttribute will be a 1D array of integers, floats and strings.
Version:
2.0 4/2/2018
Author:
Peter X. Cao, Jordan T. Henderson
See Also: