gov.nasa.gsfc.drl.rtstps.core.output.hdf5
Class AllDataReader

java.lang.Object
  extended by gov.nasa.gsfc.drl.rtstps.core.output.hdf5.AllDataReader
All Implemented Interfaces:
java.util.Iterator<RDRAllReader>

public class AllDataReader
extends java.lang.Object
implements java.util.Iterator<RDRAllReader>

Supports the reading of RDR files /All_Data group using an Iterator. The iterator returns a RDRAllReader for each specific RDR found in the group. The HDF file is assumed to have been been opened outside this class.


Field Summary
private  int allDataGroupHandle
           
private  long counter
           
private  long numObjects
           
 
Constructor Summary
AllDataReader(int hdfFile)
          Open the /All_Data group of the HDF file specified in the input argument as a handle to an already open HDF file.
AllDataReader(int allDataGroupHandle, boolean useAllData)
          Alternate constructor that takes as input an already open /All_Data handle instead of the HDF root handle.
 
Method Summary
 void close()
          Close the RDRAllReader
 int getCount()
          Return the number of items in the group.
 java.lang.String[] getNames()
          Return the names of the items found in the group
 RDRAllReader getRDRAllReaderByRDRName(RDRName rdrName)
          Return an RDR All_Data reader (RDRAllReader) for the specified RDR in the /All_Data if it exists.
 boolean hasNext()
          Return if there is another item in the /All_Data
 RDRAllReader next()
          Return the next RDRAllReader
 void remove()
          Not supported
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

allDataGroupHandle

private int allDataGroupHandle

numObjects

private long numObjects

counter

private long counter
Constructor Detail

AllDataReader

public AllDataReader(int hdfFile)
              throws RtStpsException
Open the /All_Data group of the HDF file specified in the input argument as a handle to an already open HDF file.

Parameters:
hdfFile - a handle the already open HDF file
Throws:
RtStpsException - Wraps any HDF library exceptions in an RtStpsException

AllDataReader

public AllDataReader(int allDataGroupHandle,
                     boolean useAllData)
              throws RtStpsException
Alternate constructor that takes as input an already open /All_Data handle instead of the HDF root handle. To differentiate the two constructors a fake 'useAllData' argument is must be given to differentiate the two constructors.

Parameters:
allDataGroupHandle - already opened HDF handle to the /All_Data area of an RDR file
useAllData - value is ignored but differentiates constructors
Throws:
RtStpsException - Wraps any HDF library exceptions in an RtStpsException
Method Detail

getRDRAllReaderByRDRName

public RDRAllReader getRDRAllReaderByRDRName(RDRName rdrName)
                                      throws RtStpsException
Return an RDR All_Data reader (RDRAllReader) for the specified RDR in the /All_Data if it exists.

Parameters:
rdrName - the name of the RDR of interest
Returns:
an instance of RDRAllReader for the named RDR if it exists in the /All_Data
Throws:
RtStpsException - Wraps any HDF library exceptions, including if the specified RDR does not exist.

close

public void close()
           throws RtStpsException
Close the RDRAllReader

Throws:
RtStpsException - Wraps any HDF library exceptions

getCount

public int getCount()
Return the number of items in the group.

Returns:
an int count of the number of items

getNames

public java.lang.String[] getNames()
                            throws RtStpsException
Return the names of the items found in the group

Returns:
a string array containing the names in the group
Throws:
RtStpsException - Wraps any HDF library exceptions

hasNext

public boolean hasNext()
Return if there is another item in the /All_Data

Specified by:
hasNext in interface java.util.Iterator<RDRAllReader>
Returns:
true if here is another item, false if there is not

next

public RDRAllReader next()
Return the next RDRAllReader

Specified by:
next in interface java.util.Iterator<RDRAllReader>
Returns:
an instance of RDRAllReader

remove

public void remove()
Not supported

Specified by:
remove in interface java.util.Iterator<RDRAllReader>
Throws:
RtStpsRuntimeException