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.Exception
public 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.Exception
public TableReader(java.lang.Object table, java.net.URL dataFile, boolean checkSize) throws InvalidTableException, java.lang.Exception
InvalidTableException
java.lang.Exception
public TableReader(java.lang.Object table, java.net.URL dataFile, boolean checkSize, boolean readEntireFile) throws InvalidTableException, java.lang.Exception
InvalidTableException
java.lang.Exception
public TableReader(java.lang.Object table, java.net.URL dataFile, DataObjectLocation location, boolean checkSize, boolean readEntireFile, boolean keepQuotationsFlag) throws InvalidTableException, java.lang.Exception
InvalidTableException
java.lang.Exception
public 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 nullInvalidTableException
java.lang.Exception
public 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.CsvValidationException
java.io.IOException
public TableRecord getRecord(int index) throws java.lang.IllegalArgumentException, java.io.IOException, com.opencsv.exceptions.CsvValidationException
index
- the record index (1-relative)TableRecord
java.lang.IllegalArgumentException
- if index is greater than the record numbercom.opencsv.exceptions.CsvValidationException
java.io.IOException
public 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.TableRecord
java.lang.IllegalArgumentException
- if index is greater than the record numbercom.opencsv.exceptions.CsvValidationException
java.io.IOException
public 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.Exception
public long getOffset()
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException
public DataObjectLocation getDataObjectLocation()
public void setDataObjectLocation(DataObjectLocation dataObjectLocation)
Copyright © 2023 Planetary Data System. All rights reserved.