public class TableReader
extends java.lang.Object
TableReader class defines methods for reading table records.| Modifier and Type | Field and Description |
|---|---|
protected ByteWiseFileAccessor |
accessor |
| Constructor and Description |
|---|
TableReader(java.lang.Object table,
java.io.File dataFile) |
TableReader(java.lang.Object table,
java.net.URL dataFile)
Constructs a
TableReader instance for reading records from a
data file associated with a table object. |
TableReader(java.lang.Object table,
java.net.URL dataFile,
boolean checkSize) |
TableReader(java.lang.Object table,
java.net.URL dataFile,
boolean checkSize,
boolean readEntireFile) |
TableReader(java.lang.Object table,
java.net.URL dataFile,
boolean checkSize,
boolean readEntireFile,
boolean keepQuotationsFlag)
Constructs a
TableReader instance for reading records from a
data file associated with a table object. |
| Modifier and Type | Method and Description |
|---|---|
ByteWiseFileAccessor |
getAccessor() |
TableAdapter |
getAdapter() |
int |
getCurrentRow() |
java.util.Map<java.lang.String,java.lang.Integer> |
getFieldMap() |
FieldDescription[] |
getFields()
Gets the field descriptions for fields in the table.
|
long |
getOffset() |
TableRecord |
getRecord(int index)
Gets access to the table record given the index.
|
TableRecord |
getRecord(int index,
boolean keepQuotationsFlag)
Gets access to the table record given the index.
|
long |
getRecordSize(java.net.URL dataFile,
java.lang.Object table) |
TableRecord |
readNext()
Reads the next record from the data file.
|
void |
setCurrentRow(int row)
Sets the current row.
|
protected ByteWiseFileAccessor accessor
public TableReader(java.lang.Object table,
java.io.File dataFile)
throws java.lang.Exception
java.lang.Exceptionpublic TableReader(java.lang.Object table,
java.net.URL dataFile)
throws java.lang.Exception
TableReader instance for reading records from a
data file associated with a table object.table - a table objectdataFile - an input data filejava.lang.NullPointerException - if table offset is nulljava.lang.Exceptionpublic TableReader(java.lang.Object table,
java.net.URL dataFile,
boolean checkSize)
throws java.lang.Exception
java.lang.Exceptionpublic TableReader(java.lang.Object table,
java.net.URL dataFile,
boolean checkSize,
boolean readEntireFile)
throws java.lang.Exception
java.lang.Exceptionpublic TableReader(java.lang.Object table,
java.net.URL dataFile,
boolean checkSize,
boolean readEntireFile,
boolean keepQuotationsFlag)
throws java.lang.Exception
TableReader instance for reading records from a
data file associated with a table object.table - a table objectdataFile - an input data filecheckSize - check that the size of the data file is equal to the
size of the table (length * records) + offset.readEntireFile - flag to read an entire filekeepQuotationsFlag - flag to keep the starting/ending quotesjava.lang.NullPointerException - if table offset is nulljava.lang.Exceptionpublic TableAdapter getAdapter()
public FieldDescription[] getFields()
public java.util.Map<java.lang.String,java.lang.Integer> getFieldMap()
public TableRecord readNext() throws java.io.IOException, com.opencsv.exceptions.CsvValidationException
com.opencsv.exceptions.CsvValidationExceptionjava.io.IOExceptionpublic TableRecord getRecord(int index) throws java.lang.IllegalArgumentException, java.io.IOException, com.opencsv.exceptions.CsvValidationException
index - the record index (1-relative)TableRecordjava.lang.IllegalArgumentException - if index is greater than the record numbercom.opencsv.exceptions.CsvValidationExceptionjava.io.IOExceptionpublic TableRecord getRecord(int index, boolean keepQuotationsFlag) throws java.lang.IllegalArgumentException, java.io.IOException, com.opencsv.exceptions.CsvValidationException
index - the record index (1-relative)keepQuotationsFlag - flag to keep the starting/ending quotes or not.TableRecordjava.lang.IllegalArgumentException - if index is greater than the record numbercom.opencsv.exceptions.CsvValidationExceptionjava.io.IOExceptionpublic void setCurrentRow(int row)
row - The row to set.public int getCurrentRow()
public ByteWiseFileAccessor getAccessor()
public long getRecordSize(java.net.URL dataFile,
java.lang.Object table)
throws java.lang.Exception
java.lang.Exceptionpublic long getOffset()
Copyright © 2022 Planetary Data System. All rights reserved.