Package gov.nasa.pds.objectAccess
Class RawTableReader
java.lang.Object
gov.nasa.pds.objectAccess.TableReader
gov.nasa.pds.objectAccess.RawTableReader
- All Implemented Interfaces:
Closeable,AutoCloseable
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, dataObjectLocation -
Constructor Summary
ConstructorsConstructorDescriptionRawTableReader(Object table, URL dataFile, DataObjectLocation location, boolean checkSize) RawTableReader(Object table, URL dataFile, URL label, DataObjectLocation location, boolean readEntireFile) Constructor.RawTableReader(Object table, URL dataFile, URL label, DataObjectLocation location, boolean readEntireFile, boolean keepQuotationsFlag) Constructor.RawTableReader(Object table, URL dataFile, URL label, DataObjectLocation location, boolean readEntireFile, boolean keepQuotationsFlag, RandomAccessFile raf, InputStream inputStream) Constructor. -
Method Summary
Methods inherited from class gov.nasa.pds.objectAccess.TableReader
close, getAccessor, getAdapter, getCurrentRow, getDataObjectLocation, getFieldMap, getFields, getInputStream, getOffset, getRecord, getRecordSize, setCurrentRow, setCurrentRow, setDataObjectLocation
-
Constructor Details
-
RawTableReader
public RawTableReader(Object table, URL dataFile, URL label, DataObjectLocation location, boolean readEntireFile) throws Exception Constructor.- Parameters:
table- The table object.dataFile- The data file.label- The label.location- The location of the table within the metadata definitionreadEntireFile- 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, DataObjectLocation location, boolean readEntireFile, boolean keepQuotationsFlag) throws Exception Constructor.- Parameters:
table- The table object.dataFile- The data file.label- The label.location- The location of the table within the metadata definitionreadEntireFile- 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.
-
RawTableReader
public RawTableReader(Object table, URL dataFile, URL label, DataObjectLocation location, boolean readEntireFile, boolean keepQuotationsFlag, RandomAccessFile raf, InputStream inputStream) throws Exception Constructor.- Parameters:
table- The table object.dataFile- The data file.label- The label.location- The location of the table within the metadata definitionreadEntireFile- Set to 'true' to read in entire data file.keepQuotationsFlag- Flag to optionally preserve the leading and trailing quotes.fileChannel- file channel stream used for ByteWideFileAccessorinputStream- input stream of the file used for CSVReader- Throws:
Exception- If table offset is null.
-
RawTableReader
public RawTableReader(Object table, URL dataFile, DataObjectLocation location, boolean checkSize) throws InvalidTableException, Exception - Throws:
InvalidTableExceptionException
-
-
Method Details
-
readNextLine
Previews the next line in the data file.- Returns:
- the next line, or null if no further lines.
- Throws:
IOException
-
readNextFixedLine
Previews the next fixed length 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:
readNextin classTableReader- Returns:
- a table record, with the location set.
- Throws:
IOException
-
getRecord
public TableRecord getRecord(long index, boolean keepQuotationsFlag) throws IllegalArgumentException, IOException Gets a record in the table.- Overrides:
getRecordin classTableReader- Parameters:
The- index of the record.- Returns:
- a table record, with the location set.
- Throws:
IllegalArgumentException- if index is greater than the record numberIOException
-