- All Known Implementing Classes:
Attribute
,CompoundDS
,Dataset
,Datatype
,FitsDataset
,FitsDatatype
,FitsGroup
,Group
,H4Attribute
,H4Datatype
,H4GRImage
,H4Group
,H4SDS
,H4Vdata
,H5Attribute
,H5CompoundDS
,H5Datatype
,H5Group
,H5Link
,H5ScalarDS
,NC2Attribute
,NC2Dataset
,NC2Datatype
,NC2Group
,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
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 Details
-
getMetadata
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
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
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
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.
-