TableReader, Iterable<Object[]>, Iterator<Object[]>AbstractStreamTableReader, JdbcReader, JTableReaderpublic abstract class AbstractTableReader extends Object implements TableReader
| Constructor | Description |
|---|---|
AbstractTableReader() |
Default Constructor.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
addCommentCallBack(CommentCallback callback) |
Deprecated.
Use
TableReader.registerCommentCallBack(CommentCallback) instead. |
void |
close() |
Does nothing
|
protected Object |
convert(int columnIndex,
String value) |
Converts the string back to correct object.
|
protected Object |
convert(String type,
String value) |
Converts the string back to correct object.
|
protected Object[] |
convertArray(String[] columns) |
Returns an array from the columns.
|
protected Object[] |
convertArray(List<String> columns) |
Returns an array from the columns.
|
Object |
get(String name,
Object[] row) |
Returns the value in column with specified name.
|
int |
getColumnIndex(String name) |
Returns the column index of given column name.
|
String |
getColumnType(int columnIndex) |
Returns the type of a column.
|
Object[] |
getHeaderRow() |
Returns the header row.
|
int |
getLineCount() |
Line count reflects the lines in an input file.
|
int |
getMinimumColumnCount() |
Returns the minimum number of columns to be returned by
Iterator.next(). |
int |
getRowCount() |
Returns the row count.
|
protected TypeConversionHandler |
getTypeConversionHandler(String type) |
Returns a type conversion handler for the given type.
|
boolean |
hasHeaderRow() |
Tells whether the underlying stream has a header row or not
|
protected int |
incrementLineCount() |
Increases the line count.
|
protected int |
incrementRowCount() |
Increments the row Count.
|
boolean |
isHeaderRowRead() |
|
Iterator<Object[]> |
iterator() |
|
protected void |
notifyComment(String s,
int row,
int cell) |
Notifies all comment callbacks about a comment.
|
void |
open() |
Opens the CSV reader.
|
protected void |
readHeaderRow() |
Reads the header row if required.
|
void |
registerCommentCallBack(CommentCallback callback) |
Adds a comment callback.
|
void |
registerTypeConversionHandler(TypeConversionHandler handler) |
Registers a type conversion handler.
|
void |
removeCommentCallBack(CommentCallback callback) |
Deprecated.
|
void |
reset() |
Resets the CSV reader and its underlying stream.
|
void |
setColumnType(int columnIndex,
Class<?> type) |
Explicitely set the type of a column.
|
void |
setHasHeaderRow(boolean hasHeaderRow) |
Tells the reader whether the underlying stream will treat
first row as header row.
|
protected void |
setHeaderRow(String[] names) |
Sets the header rows.
|
protected void |
setHeaderRowRead(boolean headerRowRead) |
|
void |
setMinimumColumnCount(int length) |
Sets the minimum number of columns to be returned by
Iterator.next(). |
void |
unregisterCommentCallBack(CommentCallback callback) |
Removes a comment callback.
|
void |
unregisterTypeConversionHandler(TypeConversionHandler handler) |
Unregisters a type conversion handler.
|
forEach, spliteratorforEachRemaining, hasNext, next, removepublic void open()
open in interface TableReaderpublic void reset()
reset in interface TableReaderpublic Object[] getHeaderRow()
getHeaderRow in interface TableReaderprotected void readHeaderRow()
protected void setHeaderRow(String[] names)
names - names to be setprotected void setHeaderRowRead(boolean headerRowRead)
headerRowRead - the headerRowRead to setpublic Object get(String name, Object[] row)
name - name of column (from header row)row - row of valuespublic int getColumnIndex(String name)
getColumnIndex in interface TableReadername - name of columnpublic void setColumnType(int columnIndex,
Class<?> type)
columnIndex - index of columntype - type of columngetTypeConversionHandler(String),
convert(int, String)public String getColumnType(int columnIndex)
columnIndex - index of column.getTypeConversionHandler(String),
convert(int, String)public boolean hasHeaderRow()
hasHeaderRow in interface TableReaderpublic void setHasHeaderRow(boolean hasHeaderRow)
setHasHeaderRow in interface TableReaderhasHeaderRow - true if there is a header row.public void addCommentCallBack(CommentCallback callback)
TableReader.registerCommentCallBack(CommentCallback) instead.callback - the callbackpublic void registerCommentCallBack(CommentCallback callback)
registerCommentCallBack in interface TableReadercallback - the callbackpublic void removeCommentCallBack(CommentCallback callback)
TableReader.unregisterCommentCallBack(CommentCallback) insteadcallback - the callbackpublic void unregisterCommentCallBack(CommentCallback callback)
unregisterCommentCallBack in interface TableReadercallback - the callbackprotected void notifyComment(String s, int row, int cell)
s - the comment to notify aboutrow - row numbercell - cell number in rowpublic void registerTypeConversionHandler(TypeConversionHandler handler)
handler - handler to registerpublic void unregisterTypeConversionHandler(TypeConversionHandler handler)
handler - handler to unregisterprotected Object convert(int columnIndex, String value)
getColumnType(int) and then
then forward the transformation to convert(String, String).columnIndex - index of column of this valuevalue - string representation of objectconvert(String, String),
registerTypeConversionHandler(TypeConversionHandler),
getColumnType(int)protected Object convert(String type, String value)
type - type of object being returnedvalue - string representation of objectprotected TypeConversionHandler getTypeConversionHandler(String type)
type - type to get a handler forprotected int incrementLineCount()
public int getLineCount()
protected int incrementRowCount()
Iterator.next().public int getRowCount()
Iterator.next().public void close()
close in interface TableReaderTableReader.close()public void setMinimumColumnCount(int length)
TableReaderIterator.next().setMinimumColumnCount in interface TableReaderlength - number of columnsTableReader.setMinimumColumnCount(int)public int getMinimumColumnCount()
TableReaderIterator.next().getMinimumColumnCount in interface TableReaderprotected Object[] convertArray(List<String> columns)
columns - columns to returnprotected Object[] convertArray(String[] columns)
columns - columns to returnpublic boolean isHeaderRowRead()
Copyright © 2018. All rights reserved.