|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.jameleon.data.CsvDataDriver
public class CsvDataDriver
Am implementation of @{link DataDriver} for CSV Files. This implementation can accept different delimiters. The default delimiter is ','.
Field Summary | |
---|---|
protected File |
csvFile
|
protected static char |
DEFAULT_DELIMETER
|
protected char |
delimiter
|
protected String |
encoding
|
protected BufferedReader |
in
|
protected List |
keys
|
protected String |
line
|
Constructor Summary | |
---|---|
CsvDataDriver()
Default construtor. |
|
CsvDataDriver(File csvFile)
Sets the file to be read in to csvFile |
|
CsvDataDriver(File csvFile,
char delimiter)
Sets the file and the delimiter of the file to be read in |
Method Summary | |
---|---|
void |
close()
Closes the handle to the data source |
char |
getDelimiter()
Gets the field delimiter for the csv file |
String |
getEncoding()
Gets the encoding of the csv file. |
File |
getFile()
Gets the CSV file used as a datasource. |
Map |
getNextRow()
Gets the next row from the data source |
protected void |
getNextUcommentedLine()
|
boolean |
hasMoreRows()
Tells whether the data source has another row |
protected boolean |
isLineCommented(String line)
|
void |
open()
Opens the handle to the data source |
protected List |
parseLine(String line,
boolean keysLine)
|
protected void |
readLine()
|
void |
setDelimiter(char delimiter)
Sets the field delimiter for the csv file |
void |
setEncoding(String encoding)
Sets the encoding of the csv file. |
void |
setFile(File csvFile)
Sets the CSV file used as a datasource. |
protected void |
setKeys()
Sets the key columns from the csv file |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected File csvFile
protected BufferedReader in
protected static final char DEFAULT_DELIMETER
protected char delimiter
protected String encoding
protected List keys
protected String line
Constructor Detail |
---|
public CsvDataDriver()
public CsvDataDriver(File csvFile)
csvFile
csvFile
- - the file to be used for parsingpublic CsvDataDriver(File csvFile, char delimiter)
csvFile
- - the file to be used for parsingdelimiter
- - the field delimiter of the csv file.Method Detail |
---|
public void close()
close
in interface DataDriver
public void open() throws IOException
open
in interface DataDriver
IOException
- when the data source can not be found.public String getEncoding()
public void setEncoding(String encoding)
encoding
- - the encoding of the csv filepublic File getFile()
public void setFile(File csvFile)
csvFile
- - the CSV file used as a datasource.public Map getNextRow()
getNextRow
in interface DataDriver
IllegalStateException
- if there are more values than keyspublic char getDelimiter()
public void setDelimiter(char delimiter)
delimiter
- - the field delimiter for the csv fileprotected void setKeys()
public boolean hasMoreRows()
hasMoreRows
in interface DataDriver
protected List parseLine(String line, boolean keysLine)
protected boolean isLineCommented(String line)
protected void readLine()
protected void getNextUcommentedLine()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |