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()
DataReader
read
in interface DataReader
true
if the reader successfully moved to a new record, or false
if no more records are present.public boolean isNull(int columnIndex)
DataRecord
isNull
in interface DataRecord
true
if the value is null (missing), false
otherwise.public void close()
DataReader
close
in interface DataReader
close
in interface Closeable
close
in interface AutoCloseable
public String getString(int columnIndex)
DataRecord
getString
in interface DataRecord
public boolean getBoolean(int columnIndex)
DataRecord
getBoolean
in interface DataRecord
columnIndex
- The zero based column index.public int getInt(int columnIndex)
DataRecord
getInt
in interface DataRecord
columnIndex
- The zero based column index.public long getLong(int columnIndex)
DataRecord
getLong
in interface DataRecord
columnIndex
- The zero based column index.public float getFloat(int columnIndex)
DataRecord
getFloat
in interface DataRecord
columnIndex
- The zero based column index.public double getDouble(int columnIndex)
DataRecord
getDouble
in interface DataRecord
columnIndex
- The zero based column index.public Object getObject(int columnIndex)
DataRecord
getObject
in interface DataRecord
public int getColumnIndex(String columnLabel)
DataRecord
getColumnIndex
in interface DataRecord
columnLabel
- The name of the column.public String getColumnName(int columnIndex)
DataRecord
getColumnName
in interface DataRecord
columnIndex
- The zero based index of the column.public Class<?> getColumnType(int columnIndex)
DataRecord
getColumnType
in interface DataRecord
public int getColumnCount()
DataRecord
getColumnCount
in interface DataRecord
Copyright © 2021. All rights reserved.