public class TableReader extends Object
TableReader class defines methods for reading table records.| Modifier and Type | Field and Description |
|---|---|
protected ByteWiseFileAccessor |
accessor |
| Constructor and Description |
|---|
TableReader(Object table,
File dataFile) |
TableReader(Object table,
URL dataFile)
Constructs a
TableReader instance for reading records from a
data file associated with a table object. |
TableReader(Object table,
URL dataFile,
boolean checkSize) |
TableReader(Object table,
URL dataFile,
boolean checkSize,
boolean readEntireFile) |
TableReader(Object table,
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() |
Map<String,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(URL dataFile,
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(Object table, URL dataFile) throws Exception
TableReader instance for reading records from a
data file associated with a table object.table - a table objectdataFile - an input data fileNullPointerException - if table offset is nullExceptionpublic TableReader(Object table, URL dataFile, boolean checkSize) throws Exception
Exceptionpublic TableReader(Object table, URL dataFile, boolean checkSize, boolean readEntireFile) throws Exception
Exceptionpublic TableReader(Object table, URL dataFile, boolean checkSize, boolean readEntireFile, boolean keepQuotationsFlag) throws 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 quotesNullPointerException - if table offset is nullExceptionpublic TableAdapter getAdapter()
public FieldDescription[] getFields()
public TableRecord readNext() throws IOException, com.opencsv.exceptions.CsvValidationException
com.opencsv.exceptions.CsvValidationExceptionIOExceptionpublic TableRecord getRecord(int index) throws IllegalArgumentException, IOException, com.opencsv.exceptions.CsvValidationException
index - the record index (1-relative)TableRecordIllegalArgumentException - if index is greater than the record numbercom.opencsv.exceptions.CsvValidationExceptionIOExceptionpublic TableRecord getRecord(int index, boolean keepQuotationsFlag) throws IllegalArgumentException, IOException, com.opencsv.exceptions.CsvValidationException
index - the record index (1-relative)keepQuotationsFlag - flag to keep the starting/ending quotes or not.TableRecordIllegalArgumentException - if index is greater than the record numbercom.opencsv.exceptions.CsvValidationExceptionIOExceptionpublic void setCurrentRow(int row)
row - The row to set.public int getCurrentRow()
public ByteWiseFileAccessor getAccessor()
public long getRecordSize(URL dataFile, Object table) throws Exception
Exceptionpublic long getOffset()
Copyright © 2021. All rights reserved.