public final class DataTableReader extends Object implements DataReader
| Constructor and Description |
|---|
DataTableReader(DataTable table)
Creats a new DataTableReader instance, backed by a DataTable, a simple in-memory data store.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the reader and any associated resources, such as database connections or files.
|
boolean |
getBoolean(int columnIndex)
Gets a boolean value for the specified column.
|
int |
getColumnCount()
Gets the number of columns (fields) in the data.
|
int |
getColumnIndex(String columnLabel)
Gets the zero based column index for a column name.
|
String |
getColumnName(int columnIndex)
Gets the name of the column at the specified index.
|
Class<?> |
getColumnType(int columnIndex)
Get the data type for the specified column.
|
double |
getDouble(int columnIndex)
Gets a double value for the specified column.
|
float |
getFloat(int columnIndex)
Gets a float value for the specified column.
|
int |
getInt(int columnIndex)
Gets an integer value for the specified column.
|
long |
getLong(int columnIndex)
Gets a long value for the specified column.
|
Object |
getObject(int columnIndex)
Gets an Object representation for the value at the specified column.
|
String |
getString(int columnIndex)
Gets a string value for the specified column.
|
boolean |
isNull(int columnIndex)
Determines whether the value is null (missing) for the specified column.
|
boolean |
read()
Moves to the next record, if any exist.
|
public DataTableReader(DataTable table)
table - public boolean read()
DataReaderread in interface DataReadertrue if the reader successfully moved to a new record, or false if no more records are present.public boolean isNull(int columnIndex)
DataRecordisNull in interface DataRecordtrue if the value is null (missing), false otherwise.public void close()
DataReaderclose in interface DataReaderclose in interface Closeableclose in interface AutoCloseablepublic String getString(int columnIndex)
DataRecordgetString in interface DataRecordpublic boolean getBoolean(int columnIndex)
DataRecordgetBoolean in interface DataRecordcolumnIndex - The zero based column index.public int getInt(int columnIndex)
DataRecordgetInt in interface DataRecordcolumnIndex - The zero based column index.public long getLong(int columnIndex)
DataRecordgetLong in interface DataRecordcolumnIndex - The zero based column index.public float getFloat(int columnIndex)
DataRecordgetFloat in interface DataRecordcolumnIndex - The zero based column index.public double getDouble(int columnIndex)
DataRecordgetDouble in interface DataRecordcolumnIndex - The zero based column index.public Object getObject(int columnIndex)
DataRecordgetObject in interface DataRecordpublic int getColumnIndex(String columnLabel)
DataRecordgetColumnIndex in interface DataRecordcolumnLabel - The name of the column.public String getColumnName(int columnIndex)
DataRecordgetColumnName in interface DataRecordcolumnIndex - The zero based index of the column.public Class<?> getColumnType(int columnIndex)
DataRecordgetColumnType in interface DataRecordpublic int getColumnCount()
DataRecordgetColumnCount in interface DataRecordCopyright © 2021. All rights reserved.