Interface DataFormat

All Known Implementing Classes:
CompoundDS, Dataset, Datatype, Group, HObject, ScalarDS

public interface DataFormat
An interface that provides general I/O operations for read/write object data. For example, reading data content or data attribute from file into memory or writing data content or data attribute from memory into file.

Version:
1.1 9/4/2007
Author:
Peter X. Cao
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the full path of the file that contains this data object.
    Retrieves the metadata such as attributes from file.
    boolean
    Check if the object has any attributes attached.
    void
    Deletes an existing metadata from this data object.
    void
    Updates an existing metadata from this data object.
    void
    Writes a specific metadata (such as attribute) into file.
  • Method Details

    • getFile

      String getFile()
      Returns the full path of the file that contains this data object.

      The file name is necessary because data objects are uniquely identified by object reference and file name when mutilple files are opened at the same time.

    • getMetadata

      List getMetadata() throws Exception
      Retrieves the metadata such as attributes from file.

      Metadata such as attributes are stored in a List.

      Returns:
      the list of metadata objects.
      Throws:
      Exception
    • writeMetadata

      void writeMetadata(Object info) throws Exception
      Writes a specific metadata (such as attribute) into file.

      If an HDF(4&5) attribute exists in file, the method updates its value. If the attribute does not exists in file, it creates the attribute in 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 file, one needs to get the instance of the attribute by getMetadata(), change its values, and use writeMetadata() to write the value.

      Parameters:
      info - the metadata to write.
      Throws:
      Exception
    • removeMetadata

      void removeMetadata(Object info) throws Exception
      Deletes an existing metadata from this data object.
      Parameters:
      info - the metadata to delete.
      Throws:
      Exception
    • updateMetadata

      void updateMetadata(Object info) throws Exception
      Updates an existing metadata from this data object.
      Parameters:
      info - the metadata to update.
      Throws:
      Exception
    • hasAttribute

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