Package hdf.object

Interface MetaDataContainer

  • All Known Implementing Classes:
    Attribute, CompoundDS, Dataset, Datatype, Group, ScalarDS

    public interface MetaDataContainer
    An interface that provides general I/O operations for object metadata attached to an object. For example, reading metadata content from the file into memory or writing metadata content from memory into the file.

    Version:
    2.0 4/2/2018
    Author:
    Peter X. Cao, Jordan T. Henderson
    See Also:
    HObject
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      List getMetadata()
      Retrieves the object's metadata, such as attributes, from the file.
      boolean hasAttribute()
      Check if the object has any attributes attached.
      void removeMetadata​(Object metadata)
      Deletes an existing piece of metadata from this object.
      void updateMetadata​(Object metadata)
      Updates an existing piece of metadata attached to this object.
      void writeMetadata​(Object metadata)
      Writes a specific piece of metadata (such as an attribute) into the file.
    • Method Detail

      • getMetadata

        List getMetadata()
                  throws Exception
        Retrieves the object's metadata, such as attributes, from the file.

        Metadata, such as attributes, is stored in a List.

        Returns:
        the list of metadata objects.
        Throws:
        Exception - if the metadata can not be retrieved
      • writeMetadata

        void writeMetadata​(Object metadata)
                    throws Exception
        Writes a specific piece of metadata (such as an attribute) into the file. If an HDF(4&5) attribute exists in the file, this method updates its value. If the attribute does not exist in the file, it creates the attribute in the file and attaches it to the object. It will fail to write a new attribute to the object where an attribute with the same name already exists. To update the value of an existing attribute in the file, one needs to get the instance of the attribute by getMetadata(), change its values, then use writeMetadata() to write the value.
        Parameters:
        metadata - the metadata to write.
        Throws:
        Exception - if the metadata can not be written
      • removeMetadata

        void removeMetadata​(Object metadata)
                     throws Exception
        Deletes an existing piece of metadata from this object.
        Parameters:
        metadata - the metadata to delete.
        Throws:
        Exception - if the metadata can not be removed
      • updateMetadata

        void updateMetadata​(Object metadata)
                     throws Exception
        Updates an existing piece of metadata attached to this object.
        Parameters:
        metadata - the metadata to update.
        Throws:
        Exception - if the metadata can not be updated
      • hasAttribute

        boolean hasAttribute()
        Check if the object has any attributes attached.
        Returns:
        true if it has any attributes, false otherwise.