gov.nasa.pds.objectAccess
Class TableReader

java.lang.Object
  extended by gov.nasa.pds.objectAccess.TableReader

public class TableReader
extends Object

The TableReader class defines methods for reading table records.


Constructor Summary
TableReader(Object table, File dataFile)
          Constructs a TableReader instance for reading records from a data file associated with a table object.
 
Method Summary
 FieldDescription[] getFields()
          Gets the field descriptions for fields in the table.
 TableRecord getRecord(int index)
          Gets access to the table record given the index.
 TableRecord readNext()
          Reads the next record from the data file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableReader

public TableReader(Object table,
                   File dataFile)
            throws Exception
Constructs a TableReader instance for reading records from a data file associated with a table object.

Parameters:
table - a table object
dataFile - an input data file
Throws:
NullPointerException - if table offset is null
Exception
Method Detail

getFields

public FieldDescription[] getFields()
Gets the field descriptions for fields in the table.

Returns:
an array of field descriptions

readNext

public TableRecord readNext()
                     throws IOException
Reads the next record from the data file.

Returns:
the next record, or null if no further records.
Throws:
IOException

getRecord

public TableRecord getRecord(int index)
                      throws IllegalArgumentException,
                             IOException
Gets access to the table record given the index. The current row is set to this index, thus, subsequent call to readNext() gets the next record from this position.

Parameters:
index - the record index (1-relative)
Returns:
an instance of TableRecord
Throws:
IllegalArgumentException - if index is greater than the record number
IOException


Copyright © 2013. All Rights Reserved.