ncsa.hdf.object.h5
Class H5Link

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

public class H5Link
extends HObject

An H5Link object represents an existing HDF5 object in file.

H5Link object is an HDF5 object that is either a soft or an external link to an object in a file that does not exist. The type of the object is unknown. Once the object being linked to is created, and the type is known, then H5link object will change its type.

Version:
2.7.2 7/6/2010
Author:
Nidhi Gupta
See Also:
Serialized Form

Field Summary
static long serialVersionUID
           
 
Fields inherited from class ncsa.hdf.object.HObject
separator
 
Constructor Summary
H5Link(FileFormat theFile, java.lang.String name, java.lang.String path)
          Constructs an HDF5 link with specific name, path, and parent.
H5Link(FileFormat theFile, java.lang.String theName, java.lang.String thePath, long[] oid)
           
 
Method Summary
 void close(int id)
          Closes access to the object.
 java.util.List getMetadata()
          Retrieves the metadata such as attributes from file.
 java.util.List getMetadata(int... attrPropList)
           
 boolean hasAttribute()
          Check if the object has any attributes attached.
 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 writeMetadata(java.lang.Object info)
          Writes a specific metadata (such as attribute) into file.
 
Methods inherited from class ncsa.hdf.object.HObject
equalsOID, getFID, getFile, getFileFormat, getFullName, getLinkTargetObjName, getName, getOID, getPath, setLinkTargetObjName, setName, setPath, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

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

H5Link

public H5Link(FileFormat theFile,
              java.lang.String name,
              java.lang.String path)
Constructs an HDF5 link with specific name, path, and parent.

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

H5Link

public H5Link(FileFormat theFile,
              java.lang.String theName,
              java.lang.String thePath,
              long[] oid)
Method Detail

close

public void close(int id)
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:
id - The object identifier.

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)

getMetadata

public java.util.List getMetadata()
                           throws java.lang.Exception
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:
java.lang.Exception

hasAttribute

public boolean hasAttribute()
Description copied from interface: DataFormat
Check if the object has any attributes attached.

Returns:
true if it has any attribute(s), false otherwise.

removeMetadata

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

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

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 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:
java.lang.Exception

getMetadata

public java.util.List getMetadata(int... attrPropList)
                           throws java.lang.Exception
Throws:
java.lang.Exception