public class CSVReader extends AbstractDataReader
This class CSVReader implements default behavior of the DataReader interface.
This class reads in the data source information from the configuration, loads the csv file data.
This class is invoked by initDataReaderConfig method in BusinessObjectLoader individual methods:
init();
read();
close();
Before you call read(), you can call other methods to get and set additional properties if
these properties are not defined in the configuration file or you want to override the value in the
configuration file. To get and set configuration properties, you can call:
getConfigProperties().getPropertyMap();
setConfigProperties().getPropertyMap();
| Constructor and Description |
|---|
CSVReader() |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the data source used for reading data.
|
java.lang.String |
getCurrentRecord() |
java.io.File |
getDataFile()
This method gets the CSV File name and then creates a File object for that particular CSV input file.
|
java.lang.Integer |
getSourcePosition()
It returns the record number in the CSV file when the last next() method is called.
|
void |
init()
It gets the input csv data file for a DataReader and gets limeDelimiter, tokenDelimeter
and tokenValueDelimiter values.
|
java.lang.Object |
next()
Reads a "record" from an open file handle, tokenizes the record and returns a map of tokenized data from the record.
|
getConfigProperties, initConfig, setConfigPropertiespublic void init()
throws DataLoadException
init in interface DataReaderinit in class AbstractDataReaderDataLoadExceptionpublic java.io.File getDataFile()
throws DataLoadException
DataLoadExceptionpublic java.lang.Object next()
throws DataLoadException
next in interface DataReadernext in class AbstractDataReaderDataLoadExceptionpublic java.lang.Integer getSourcePosition()
getSourcePosition in interface DataReadergetSourcePosition in class AbstractDataReaderpublic void close()
throws DataLoadException
Close the data source used for reading data.
close in interface DataReaderclose in class AbstractDataReaderDataLoadException - An application exception will be thrown if there was a problem closing the data source.public java.lang.String getCurrentRecord()