public class CsvReader extends Object implements FlatDataStream, Closeable
| Modifier and Type | Field and Description |
|---|---|
static char |
DEFAULT_QUOTE_CHARACTER |
static char |
DEFAULT_SEPARATOR |
| Constructor and Description |
|---|
CsvReader(File file) |
CsvReader(File file,
char separator,
char quoteChar) |
CsvReader(File file,
String charsetName,
char separator,
char quoteChar) |
CsvReader(Reader reader)
Deprecated.
Call
CsvReader(File) instead. |
CsvReader(Reader reader,
char separator,
char quoteChar)
Deprecated.
Call
CsvReader(File, char, char) instead. |
CsvReader(String filename) |
CsvReader(String fileName,
char separator,
char quoteChar) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
List<String> |
getColumnNames() |
DateFormat |
getDateFormat() |
List<String> |
getFieldNames() |
long |
getLinesRead() |
boolean |
isHeadersRead() |
FlatRecord |
nextRecord() |
void |
readHeaders() |
CsvLine |
readNextLine() |
protected void |
setColumnNames(String[] headers) |
void |
setDateFormat(DateFormat dateFormat) |
void |
setDateFormat(String pattern) |
int |
size()
Returns the number of lines including the headers
|
public static final char DEFAULT_SEPARATOR
public static final char DEFAULT_QUOTE_CHARACTER
public CsvReader(String filename) throws FileNotFoundException
FileNotFoundExceptionpublic CsvReader(String fileName, char separator, char quoteChar) throws FileNotFoundException
FileNotFoundExceptionpublic CsvReader(File file) throws FileNotFoundException
FileNotFoundExceptionpublic CsvReader(File file, char separator, char quoteChar) throws FileNotFoundException
FileNotFoundExceptionpublic CsvReader(File file, String charsetName, char separator, char quoteChar) throws FileNotFoundException
FileNotFoundException@Deprecated public CsvReader(Reader reader)
CsvReader(File) instead.@Deprecated public CsvReader(Reader reader, char separator, char quoteChar)
CsvReader(File, char, char) instead.public void readHeaders()
throws IOException
IOExceptionpublic CsvLine readNextLine() throws IOException
IOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic boolean isHeadersRead()
public long getLinesRead()
public List<String> getFieldNames()
getFieldNames in interface FlatDataStreampublic FlatRecord nextRecord() throws IOException
nextRecord in interface FlatDataStreamIOExceptionpublic DateFormat getDateFormat()
public int size()
throws IOException
IOExceptionpublic void setDateFormat(DateFormat dateFormat)
public void setDateFormat(String pattern)
protected void setColumnNames(String[] headers)
Copyright © 2020 Open Foris. All rights reserved.