ncsa.hdf.object.h5
Class H5Group

java.lang.Object
  extended by ncsa.hdf.object.HObject
      extended by ncsa.hdf.object.Group
          extended by ncsa.hdf.object.h5.H5Group
All Implemented Interfaces:
java.io.Serializable, DataFormat

public class H5Group
extends Group

An H5Group object represents an existing HDF5 group in file.

In HDF5, every object has at least one name. An HDF5 group is used to store a set of the names together in one place, i.e. a group. The general structure of a group is similar to that of the UNIX file system in that the group may contain references to other groups or data objects just as the UNIX directory may contain subdirectories or files.

For more information on HDF5 Groups,

See Also:
HDF5 User's Guide

, Serialized Form


Field Summary
protected  java.util.List attributeList
          The list of attributes of this data object.
static long serialVersionUID
           
 
Fields inherited from class ncsa.hdf.object.Group
nMembersInFile, parent
 
Fields inherited from class ncsa.hdf.object.HObject
hasAttribute, oid, separator
 
Constructor Summary
H5Group(FileFormat theFile, java.lang.String name, java.lang.String path, Group parent)
          Constructs an HDF5 group with specific name, path, and parent.
H5Group(FileFormat theFile, java.lang.String name, java.lang.String path, Group parent, long[] oid)
          Deprecated. Not for public use in the future.
Using H5Group(FileFormat, String, String, Group)
 
Method Summary
 void clear()
          Clears up member list and other resources in memory for the group.
 void close(int gid)
          Closes access to the object.
static H5Group create(java.lang.String name, Group pgroup)
          Creates a new group with a name in a group.
 java.util.List getMetadata()
          Retrieves the metadata such as attributes from file.
 int open()
          Opens an existing object such as dataset or group for access.
 void removeMetadata(java.lang.Object info)
          Deletes an existing metadata from this data object.
 void setName(java.lang.String newName)
          Sets the name of the group.
 void setPath(java.lang.String newPath)
          Sets the path of the object.
 void writeMetadata(java.lang.Object info)
          Writes a specific metadata (such as attribute) into file.
 
Methods inherited from class ncsa.hdf.object.Group
addToMemberList, getMemberList, getNumberOfMembersInFile, getParent, isRoot, removeFromMemberList
 
Methods inherited from class ncsa.hdf.object.HObject
equalsOID, getFID, getFile, getFileFormat, getFullName, getName, getOID, getPath, hasAttribute, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

public static final long serialVersionUID
See Also:
HObject.serialVersionUID, Constant Field Values

attributeList

protected java.util.List attributeList
The list of attributes of this data object. Members of the list are instance of Attribute.

Constructor Detail

H5Group

public H5Group(FileFormat theFile,
               java.lang.String name,
               java.lang.String path,
               Group parent)
Constructs an HDF5 group with specific name, path, and parent.

Parameters:
theFile - the file which containing the group.
name - the name of this group, e.g. "grp01".
path - the full path of this group, e.g. "/groups/".
parent - the parent of this group.

H5Group

public H5Group(FileFormat theFile,
               java.lang.String name,
               java.lang.String path,
               Group parent,
               long[] oid)
Deprecated. Not for public use in the future.
Using H5Group(FileFormat, String, String, Group)

Method Detail

clear

public void clear()
Description copied from class: Group
Clears up member list and other resources in memory for the group. Since the destructor will clear memory space, the function is usually not needed.

Overrides:
clear in class Group

getMetadata

public java.util.List getMetadata()
                           throws HDF5Exception
Description copied from interface: DataFormat
Retrieves the metadata such as attributes from file.

Metadata such as attributes are stored in a List.

Returns:
the list of metadata objects.
Throws:
HDF5Exception

writeMetadata

public void writeMetadata(java.lang.Object info)
                   throws java.lang.Exception
Description copied from interface: DataFormat
Writes a specific metadata (such as attribute) into file.

If metadata exists, the method updates its value. If the metadata does not exists in file, it creates the metadata in file and attaches it to the object.

Parameters:
info - the metadata to write.
Throws:
java.lang.Exception

removeMetadata

public void removeMetadata(java.lang.Object info)
                    throws HDF5Exception
Description copied from interface: DataFormat
Deletes an existing metadata from this data object.

Parameters:
info - the metadata to delete.
Throws:
HDF5Exception

open

public int open()
Description copied from class: HObject
Opens an existing object such as dataset or group for access. The return value is an object identifier obtained by implementing classes such as H5.H5Dopen(). This function is needed to allow other objects to be able to access the object. For instance, H5File class uses the open() function to obtain object identifier for copyAttributes(int src_id, int dst_id) and other purposes. The open() function should be used in pair with close(int) function.

Specified by:
open in class HObject
Returns:
the object identifier if successful; otherwise returns a negative value.
See Also:
HObject.close(int)

close

public void close(int gid)
Description copied from class: HObject
Closes access to the object.

Sub-classes must implement this interface because different data objects have their own ways of how the data resources are closed.

For example, H5Group.close() calls the ncsa.hdf.hdf5lib.H5.H5Gclose() method and closes the group resource specified by the group id.

Specified by:
close in class HObject
Parameters:
gid - The object identifier.

create

public static H5Group create(java.lang.String name,
                             Group pgroup)
                      throws java.lang.Exception
Creates a new group with a name in a group.

Parameters:
name - The name of a new group.
pgroup - The parent group object.
Returns:
The new group if successful; otherwise returns null.
Throws:
java.lang.Exception

setName

public void setName(java.lang.String newName)
             throws java.lang.Exception
Description copied from class: Group
Sets the name of the group.

setName (String newName) changes the name of the group in memory and file.

setName() updates the path in memory for all the objects that are under the group with the new name.

Overrides:
setName in class Group
Parameters:
newName - The new name of the group.
Throws:
java.lang.Exception

setPath

public void setPath(java.lang.String newPath)
             throws java.lang.Exception
Description copied from class: HObject
Sets the path of the object.

setPath() is needed to change the path for an object when the name of a group conatining the object is changed by setName(). The path of the object in memory under this group should be updated to the new path to the group. Unlike setName(), setPath() does not change anything in file.

Overrides:
setPath in class HObject
Parameters:
newPath - The new path of the object.
Throws:
java.lang.Exception