Modifier and Type | Field and Description |
---|---|
private BufferedReader |
br |
static char |
DEFAULT_QUOTE_CHARACTER
The default quote character to use if none is supplied to the
constructor.
|
static char |
DEFAULT_SEPARATOR
The default separator to use if none is supplied to the constructor.
|
static int |
DEFAULT_SKIP_LINES
The default line to start reading.
|
private boolean |
hasNext |
private boolean |
linesSkiped |
private char |
quotechar |
private char |
separator |
private int |
skipLines |
Constructor and Description |
---|
CSVReader(Reader reader)
Constructs CSVReader using a comma for the separator.
|
CSVReader(Reader reader,
char separator)
Constructs CSVReader with supplied separator.
|
CSVReader(Reader reader,
char separator,
char quotechar)
Constructs CSVReader with supplied separator and quote char.
|
CSVReader(Reader reader,
char separator,
char quotechar,
int line)
Constructs CSVReader with supplied separator and quote char.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the underlying reader.
|
private String |
getNextLine()
Reads the next line from the file.
|
private String[] |
parseLine(String nextLine)
Parses an incoming String and returns an array of elements.
|
List |
readAll()
Reads the entire file into a List with each element being a String[] of
tokens.
|
String[] |
readNext()
Reads the next line from the buffer and converts to a string array.
|
private BufferedReader br
private boolean hasNext
private char separator
private char quotechar
private int skipLines
private boolean linesSkiped
public static final char DEFAULT_SEPARATOR
public static final char DEFAULT_QUOTE_CHARACTER
public static final int DEFAULT_SKIP_LINES
public CSVReader(Reader reader)
reader
- the reader to an underlying CSV source.public CSVReader(Reader reader, char separator)
reader
- the reader to an underlying CSV source.separator
- the delimiter to use for separating entries.public CSVReader(Reader reader, char separator, char quotechar)
reader
- the reader to an underlying CSV source.separator
- the delimiter to use for separating entriesquotechar
- the character to use for quoted elementspublic CSVReader(Reader reader, char separator, char quotechar, int line)
reader
- the reader to an underlying CSV source.separator
- the delimiter to use for separating entriesquotechar
- the character to use for quoted elementsline
- the line number to skip for start readingpublic List readAll() throws IOException
IOException
- if bad things happen during the readpublic String[] readNext() throws IOException
IOException
- if bad things happen during the readprivate String getNextLine() throws IOException
IOException
- if bad things happen during the readprivate String[] parseLine(String nextLine) throws IOException
nextLine
- the string to parseIOException
- if bad things happen during the readpublic void close() throws IOException
IOException
- if the close failsWebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses