Class TableReader

java.lang.Object
gov.nasa.pds.objectAccess.TableReader
All Implemented Interfaces:
Closeable, AutoCloseable
Direct Known Subclasses:
RawTableReader

public class TableReader extends Object implements Closeable
The TableReader class defines methods for reading table records.
  • Field Details

  • Constructor Details

  • Method Details

    • getAdapter

      public TableAdapter getAdapter()
    • getFields

      public FieldDescription[] getFields()
      Gets the field descriptions for fields in the table.
      Returns:
      an array of field descriptions
    • getFieldMap

      public Map<String,Integer> getFieldMap()
      Returns:
      the field map.
    • readNext

      public TableRecord readNext() throws IOException, com.opencsv.exceptions.CsvValidationException
      Reads the next record from the data file.
      Returns:
      the next record, or null if no further records.
      Throws:
      com.opencsv.exceptions.CsvValidationException
      IOException
    • getRecord

      public TableRecord getRecord(int index) throws IllegalArgumentException, IOException, com.opencsv.exceptions.CsvValidationException
      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
      com.opencsv.exceptions.CsvValidationException
      IOException
    • getRecord

      public TableRecord getRecord(long index, boolean keepQuotationsFlag) throws IllegalArgumentException, IOException, com.opencsv.exceptions.CsvValidationException
      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)
      keepQuotationsFlag - flag to keep the starting/ending quotes or not.
      Returns:
      an instance of TableRecord
      Throws:
      IllegalArgumentException - if index is greater than the record number
      com.opencsv.exceptions.CsvValidationException
      IOException
    • setCurrentRow

      public void setCurrentRow(int row)
      Sets the current row.
      Parameters:
      row - The row to set.
    • setCurrentRow

      public void setCurrentRow(long row)
      Sets the current row.
      Parameters:
      row - The row to set.
    • getCurrentRow

      public long getCurrentRow()
      Returns:
      the current row.
    • getAccessor

      public ByteWiseFileAccessor getAccessor()
    • getInputStream

      public InputStream getInputStream()
    • getRecordSize

      public long getRecordSize(URL dataFile, Object table) throws Exception
      Returns:
      the size of record (i.e. number of lines)
      Throws:
      Exception
    • getOffset

      public long getOffset()
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException
    • getDataObjectLocation

      public DataObjectLocation getDataObjectLocation()
    • setDataObjectLocation

      public void setDataObjectLocation(DataObjectLocation dataObjectLocation)