Package gov.nasa.pds.label.object
Class TableObject
java.lang.Object
gov.nasa.pds.label.object.DataObject
gov.nasa.pds.label.object.TableObject
Implements an object that represents a table in a PDS product. The table may be binary,
character, or delimited.
-
Field Summary
Fields inherited from class gov.nasa.pds.label.object.DataObject
channel, dataObjectLocation, fileObject, localIdentifier, name, offset, parentDir -
Constructor Summary
ConstructorsConstructorDescriptionTableObject(File parentDir, File fileObject, Object tableObject, long offset, long size) Deprecated.TableObject(File parentDir, File fileObject, Object tableObject, long offset, long size, DataObjectLocation location) Creates a new instance of the table object.TableObject(URL parentDir, File fileObject, Object tableObject, long offset, long size) Deprecated.TableObject(URL parentDir, File fileObject, Object tableObject, long offset, long size, DataObjectLocation location) Creates a new instance of the table object. -
Method Summary
Modifier and TypeMethodDescriptionGets the field descriptions for fields in the table.Returns a raw table reader for this table.getRecord(int index, boolean keepQuotationsFlag) Gets access to the table record given the index.Returns a table reader for this table.readNext()Reads the next record from the data file.voidsetTableObject(Object tableObject) Methods inherited from class gov.nasa.pds.label.object.DataObject
closeChannel, getChannel, getDataFile, getDataObjectLocation, getInputStream, getLocalIdentifier, getName, getOffset, getSize, setDataObjectLocation, setLocalIdentifier, setName, setSize
-
Constructor Details
-
TableObject
public TableObject(File parentDir, File fileObject, Object tableObject, long offset, long size, DataObjectLocation location) throws Exception Creates a new instance of the table object.- Parameters:
parentDir- the parent directory for the table objectfileObject- the file object describing the data filetableObject- the table object describing the tableoffset- the offset of the table object within the data filesize- the size of the table object, in bytes- Throws:
Exception- if there is any error accessing the table
-
TableObject
public TableObject(URL parentDir, File fileObject, Object tableObject, long offset, long size, DataObjectLocation location) throws Exception Creates a new instance of the table object.- Parameters:
parentDir- the parent directory for the table objectfileObject- the file object describing the data filetableObject- the table object describing the tableoffset- the offset of the table object within the data filesize- the size of the table object, in bytes- Throws:
Exception- if there is any error accessing the table
-
TableObject
@Deprecated public TableObject(File parentDir, File fileObject, Object tableObject, long offset, long size) throws Exception Deprecated.Deprecated initializer. Missing DataObjectLocation- Throws:
Exception
-
TableObject
@Deprecated public TableObject(URL parentDir, File fileObject, Object tableObject, long offset, long size) throws Exception Deprecated.Deprecated initializer. Missing DataObjectLocation- Throws:
Exception
-
-
Method Details
-
getTableReader
Returns a table reader for this table.- Returns:
- a table reader
- Throws:
Exception- if there is an error creating the table reader
-
getRawTableReader
Returns a raw table reader for this table.- Returns:
- a table reader
- Throws:
Exception- if there is an error creating the table reader
-
getFields
Gets the field descriptions for fields in the table.- Returns:
- an array of field descriptions
- Throws:
Exception
-
readNext
public TableRecord readNext() throws IOException, com.opencsv.exceptions.CsvValidationException, ExceptionReads 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 filecom.opencsv.exceptions.CsvValidationExceptionException
-
getRecord
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:
Exception
-
getTableObject
-
setTableObject
-