public class TableReader
extends java.lang.Object
implements java.io.Closeable
TableReader class defines methods for reading table records.| Modifier and Type | Field and Description |
|---|---|
protected ByteWiseFileAccessor |
accessor |
protected DataObjectLocation |
dataObjectLocation |
| 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,
DataObjectLocation location,
boolean checkSize,
boolean readEntireFile,
boolean keepQuotationsFlag) |
TableReader(java.lang.Object table,
java.net.URL dataFile,
DataObjectLocation location,
boolean checkSize,
boolean readEntireFile,
boolean keepQuotationsFlag,
java.io.RandomAccessFile raf,
java.io.InputStream inputStream)
Constructs a
TableReader instance for reading records from a data file associated
with a table object. |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
ByteWiseFileAccessor |
getAccessor() |
TableAdapter |
getAdapter() |
long |
getCurrentRow() |
DataObjectLocation |
getDataObjectLocation() |
java.util.Map<java.lang.String,java.lang.Integer> |
getFieldMap() |
FieldDescription[] |
getFields()
Gets the field descriptions for fields in the table.
|
java.io.InputStream |
getInputStream() |
long |
getOffset() |
TableRecord |
getRecord(int index)
Gets access to the table record given the index.
|
TableRecord |
getRecord(long 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.
|
void |
setCurrentRow(long row)
Sets the current row.
|
void |
setDataObjectLocation(DataObjectLocation dataObjectLocation) |
protected ByteWiseFileAccessor accessor
protected DataObjectLocation dataObjectLocation
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 InvalidTableException,
java.lang.Exception
InvalidTableExceptionjava.lang.Exceptionpublic TableReader(java.lang.Object table,
java.net.URL dataFile,
boolean checkSize,
boolean readEntireFile)
throws InvalidTableException,
java.lang.Exception
InvalidTableExceptionjava.lang.Exceptionpublic TableReader(java.lang.Object table,
java.net.URL dataFile,
DataObjectLocation location,
boolean checkSize,
boolean readEntireFile,
boolean keepQuotationsFlag)
throws InvalidTableException,
java.lang.Exception
InvalidTableExceptionjava.lang.Exceptionpublic TableReader(java.lang.Object table,
java.net.URL dataFile,
DataObjectLocation location,
boolean checkSize,
boolean readEntireFile,
boolean keepQuotationsFlag,
java.io.RandomAccessFile raf,
java.io.InputStream inputStream)
throws InvalidTableException,
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 nullInvalidTableExceptionjava.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(long 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 void setCurrentRow(long row)
row - The row to set.public long getCurrentRow()
public ByteWiseFileAccessor getAccessor()
public java.io.InputStream getInputStream()
public long getRecordSize(java.net.URL dataFile,
java.lang.Object table)
throws java.lang.Exception
java.lang.Exceptionpublic long getOffset()
public void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOExceptionpublic DataObjectLocation getDataObjectLocation()
public void setDataObjectLocation(DataObjectLocation dataObjectLocation)
Copyright © 2023 Planetary Data System. All rights reserved.