gov.nasa.pds.label.object
Class TableObject

java.lang.Object
  extended by gov.nasa.pds.label.object.DataObject
      extended by gov.nasa.pds.label.object.TableObject

public class TableObject
extends DataObject

Implements an object that represents a table in a PDS product. The table may be binary, character, or delimited.


Constructor Summary
TableObject(File parentDir, File fileObject, Object tableObject, long offset, long size)
          Creates a new instance of the 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 gov.nasa.pds.label.object.DataObject
getBuffer, getDataFile, getInputStream, getOffset, getSize, setSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableObject

public TableObject(File parentDir,
                   File fileObject,
                   Object tableObject,
                   long offset,
                   long size)
            throws Exception
Creates a new instance of the table object.

Parameters:
parentDir - the parent directory for the table object
fileObject - the file object describing the data file
tableObject - the table object describing the table
offset - the offset of the table object within the data file
size - the size of the table object, in bytes
Throws:
Exception - if there is any error accessing the table
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 - if there is an error reading from the data file

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 - if there is an error reading from the data file


Copyright © 2014. All Rights Reserved.