|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface CSVParse
Read files in comma separated value format. More information about this class is available from ostermiller.org. This interface is designed to be set of general methods that all CSV parsers should implement.
Method Summary | |
---|---|
void |
changeDelimiter(char newDelim)
Change this parser so that it uses a new delimiter. |
void |
changeQuote(char newQuote)
Change this parser so that it uses a new character for quoting. |
void |
close()
Close any stream upon which this parser is based. |
String[][] |
getAllValues()
Get all the values from the file. |
int |
getLastCharCount()
Get the number of chars that have been read from the beginning. |
int |
getLastLineNumber()
Get the line number that the last token came from. |
String[] |
getLine()
Get all the values from a line. |
int |
lastLineNumber()
Get the line number that the last token came from. |
String |
nextValue()
Read the next value from the file. |
Method Detail |
---|
String nextValue() throws IOException
IOException
- if an error occurs while reading.int lastLineNumber()
String[] getLine() throws IOException
If the line has already been partially read, only the values that have not already been read will be included.
IOException
- if an error occurs while reading.int getLastLineNumber()
New line breaks that occur in the middle of a token are not counted in the line number count.
String[][] getAllValues() throws IOException
If the file has already been partially read, only the values that have not already been read will be included.
Each line of the file that has at least one value will be represented. Comments and empty lines are ignored.
The resulting double array may be jagged.
IOException
- if an error occurs while reading.void changeDelimiter(char newDelim) throws BadDelimiterException
The initial character is a comma, the delimiter cannot be changed to a quote or other character that has special meaning in CSV.
newDelim
- delimiter to which to switch.
BadDelimiterException
- if the character cannot be used as a delimiter.void changeQuote(char newQuote) throws BadQuoteException
The initial character is a double quote ("), the delimiter cannot be changed to a comma or other character that has special meaning in CSV.
newQuote
- character to use for quoting.
BadQuoteException
- if the character cannot be used as a quote.void close() throws IOException
IOException
- if an error occurs while closing the stream.int getLastCharCount()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |