@Status(stage=DEVELOPMENT, unitTests=PARTIAL) @Review(by="Kees Schotanus",at="2009-09-28") @Review(by="Kees Schotanus",at="2010-10-22",reason="Totally rewrote csv classes") @Review(by="Kees Schotanus",at="2013-10-09",reason="Maarten van Steenbergen suggested to add a Charset") public class CsvFileReader extends AbstractCsvReader
Constructor and Description |
---|
CsvFileReader(File file)
Constructs this CsvFileReader that will read csv data from the supplied file, using a comma as the column separator and
the default character set (for the platform running the application).
|
CsvFileReader(File file,
Character columnSeparator)
Constructs this CsvFileReader that will read csv data from the supplied file, using the supplied columnSeparator as a
column separator and the default character set (for the platform running the application).
|
CsvFileReader(File file,
Character columnSeparator,
Charset characterSet)
Constructs this CsvFileReader that will read csv data from the supplied file, using the supplied columnSeparator as a
column separator and the supplied characterSet.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes used resources.
|
protected void |
finalize()
Closes resources in case the programmer did not read all rows and forgot to call the close method!
A message of level Level.SEVERE is logged when this is the case. |
String[] |
getNextRow()
Gets the next row of columns.
|
getColumnSeparator, getRowSeparator, setColumnSeparator, setRowSeparator
public CsvFileReader(File file)
file
- The file to read the csv data from.NullPointerException
- When the supplied file is null.CsvException
- When the supplied file could not be opened.public CsvFileReader(File file, Character columnSeparator)
file
- The file to read the csv data from.columnSeparator
- The separator that separates the different columns.NullPointerException
- When either the supplied file or columnSeparator is null.CsvException
- When the supplied file could not be opened.public CsvFileReader(File file, Character columnSeparator, Charset characterSet)
file
- The file to read the csv data from.columnSeparator
- The separator that separates the different columns.characterSet
- The characterSet used for decoding.NullPointerException
- When either the supplied file or columnSeparator is null.CsvException
- When the supplied file could not be opened.public String[] getNextRow()
getNextRow
in class AbstractCsv
public void close()
getNextRow()
, then there is no need to call this method.
In all other cases, calling this method is a must.protected void finalize() throws Throwable
Level.SEVERE
is logged when this is the case.Copyright © 2008–2018. All rights reserved.