public class ImportAdapterCSV extends ImportAdapter
ImportConfigurationCSV
object. Internally
this class makes use of CSVDataInput
to read the CSV file on a line
by line basis. A counting input stream (@link CountingInputStream} is used in
order for {@link #getProgress() to be able to return the percentage of data
that has already been processed.dataTypes, header, indexes
Modifier | Constructor and Description |
---|---|
protected |
ImportAdapterCSV(ImportConfigurationCSV config)
Creates a new instance of this object with given configuration.
|
Modifier and Type | Method and Description |
---|---|
protected int[] |
getIndexesToImport()
Returns an array with indexes of columns that should be imported
Only columns listed within
#column will be imported. |
int |
getProgress()
Returns the percentage of data that has already been returned
This divides the amount of bytes that have already been read by the
amount of total bytes and casts the result into a percentage.
|
boolean |
hasNext()
|
java.lang.String[] |
next()
Returns the next row
The returned element is sorted as defined by
ImportColumn#index and contains as many elements as there are columns selected to import
from ImportAdapter.indexes . |
void |
remove()
Dummy.
|
create, getColumnDatatypes, getConfig, getHeader
protected ImportAdapterCSV(ImportConfigurationCSV config) throws java.io.IOException
config
- config
java.io.IOException
- In case file doesn't contain actual datapublic int getProgress()
getProgress
in class ImportAdapter
public boolean hasNext()
row
during the last iteration of next()
.public java.lang.String[] next()
ImportColumn#index
and contains as many elements as there are columns selected to import
from ImportAdapter.indexes
. The first row will always contain the names of the
columns. headerReturned
is used to keep track of that.public void remove()
protected int[] getIndexesToImport()
#column
will be imported. This
iterates over the list of columns and returns an array with indexes of
columns that should be imported.