public class ReadCsv
extends java.lang.Object
Base class for reading CSV formatted files. CSV stands for column-space-value where text strings are separated by a space character. The values are typically stored in a human readable format. The encoded text for a single variable is referred to as a word.
Comments are allowed and identified by starting a line with the comment character. The comment character is user configurable. By default there is no comment character.
Constructor and Description |
---|
ReadCsv(java.io.InputStream in)
Constructor for ReadCsv
|
Modifier and Type | Method and Description |
---|---|
protected java.util.List<java.lang.String> |
extractWords()
Finds the next valid line of words in the stream and extracts them.
|
int |
getLineNumber()
Returns how many lines have been read.
|
java.io.BufferedReader |
getReader()
Returns the reader that it is using internally.
|
protected java.util.List<java.lang.String> |
parseWords(java.lang.String line)
Extracts the words from a string.
|
void |
setComment(char comment)
Sets the comment character.
|
public ReadCsv(java.io.InputStream in)
in
- Where the input comes from.public void setComment(char comment)
comment
- The new comment character.public int getLineNumber()
public java.io.BufferedReader getReader()
protected java.util.List<java.lang.String> extractWords() throws java.io.IOException
java.io.IOException
protected java.util.List<java.lang.String> parseWords(java.lang.String line)
line
- The line that is being parsed.