Class RawTableReader
java.lang.Object
gov.nasa.pds.objectAccess.TableReader
gov.nasa.pds.tools.validate.content.table.RawTableReader
public class RawTableReader
extends gov.nasa.pds.objectAccess.TableReader
Table reader that provides the capability to read a table
line by line rather than record by record, which is more
strict as it relies on the label metadata.
- Author:
- mcayanan
-
Field Summary
Fields inherited from class gov.nasa.pds.objectAccess.TableReader
accessor
-
Constructor Summary
Constructors Constructor Description RawTableReader(Object table, URL dataFile, URL label, int tableIndex, boolean readEntireFile)
Constructor.RawTableReader(Object table, URL dataFile, URL label, int tableIndex, boolean readEntireFile, boolean keepQuotationsFlag)
Constructor. -
Method Summary
Modifier and Type Method Description gov.nasa.pds.label.object.TableRecord
getRecord(int index, boolean keepQuotationsFlag)
Gets a record in the table.gov.nasa.pds.label.object.TableRecord
readNext()
Reads the next record in the table.String
readNextLine()
Previews the next line in the data file.gov.nasa.pds.objectAccess.FixedTableRecord
toRecord(String line, int row)
Converts the given line to a record.Methods inherited from class gov.nasa.pds.objectAccess.TableReader
getAccessor, getAdapter, getCurrentRow, getFieldMap, getFields, getOffset, getRecord, getRecordSize, setCurrentRow
-
Constructor Details
-
RawTableReader
public RawTableReader(Object table, URL dataFile, URL label, int tableIndex, boolean readEntireFile) throws ExceptionConstructor.- Parameters:
table
- The table object.dataFile
- The data file.label
- The label.tableIndex
- The index of the table.readEntireFile
- Set to 'true' to read in entire data file.- Throws:
Exception
- If table offset is null.
-
RawTableReader
public RawTableReader(Object table, URL dataFile, URL label, int tableIndex, boolean readEntireFile, boolean keepQuotationsFlag) throws ExceptionConstructor.- Parameters:
table
- The table object.dataFile
- The data file.label
- The label.tableIndex
- The index of the table.readEntireFile
- Set to 'true' to read in entire data file.keepQuotationsFlag
- Flag to optionally preserve the leading and trailing quotes.- Throws:
Exception
- If table offset is null.
-
-
Method Details
-
readNextLine
Previews the next line in the data file.- Returns:
- the next line, or null if no further lines.
- Throws:
IOException
-
toRecord
Converts the given line to a record.- Parameters:
line
- The line to convert.row
- The row number to set.- Returns:
- A record.
-
readNext
Reads the next record in the table.- Overrides:
readNext
in classgov.nasa.pds.objectAccess.TableReader
- Returns:
- a table record, with the location set.
- Throws:
IOException
-
getRecord
public gov.nasa.pds.label.object.TableRecord getRecord(int index, boolean keepQuotationsFlag) throws IllegalArgumentException, IOExceptionGets a record in the table.- Overrides:
getRecord
in classgov.nasa.pds.objectAccess.TableReader
- Parameters:
The
- index of the record.- Returns:
- a table record, with the location set.
- Throws:
IllegalArgumentException
IOException
-