com.bbn.openmap.util
Class CSVTokenizer
java.lang.Object
java.io.Reader
java.io.FilterReader
java.io.PushbackReader
com.bbn.openmap.util.Tokenizer
com.bbn.openmap.util.CSVTokenizer
- All Implemented Interfaces:
- java.io.Closeable, java.lang.Readable
public class CSVTokenizer
- extends Tokenizer
Tokenizer for comma separated values files, at least as generated by excel.
token() returns the next token, which can be either:
- null, indicating an empty field.
- a Double, indicating a numeric field.
- a String, indicating an alphanumeric field.
- the NEWLINE object, indicating the end of a record.
- the EOF object, test with isEOF(), indicating the end of file.
Fields inherited from class java.io.FilterReader |
in |
Fields inherited from class java.io.Reader |
lock |
Constructor Summary |
CSVTokenizer(java.io.Reader in)
|
CSVTokenizer(java.io.Reader in,
boolean numberReadAsString)
If you set numberReadAsString is true, then any number will be maintained
as a String. |
Method Summary |
static void |
main(java.lang.String[] args)
|
java.lang.Object |
token()
|
protected java.lang.Object |
tokenAfterComma()
Return the next object read from the stream, called if a comma is found
first in order to catch empty fields accurately. |
Methods inherited from class com.bbn.openmap.util.Tokenizer |
bclear, bpush, error, isAlpha, isAlphanumeric, isAny, isDigit, isEOF, isNewline, next, putback |
Methods inherited from class java.io.PushbackReader |
close, mark, markSupported, read, read, ready, reset, skip, unread, unread, unread |
Methods inherited from class java.io.Reader |
read, read |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
lastTokened
protected java.lang.Object lastTokened
CSVTokenizer
public CSVTokenizer(java.io.Reader in)
CSVTokenizer
public CSVTokenizer(java.io.Reader in,
boolean numberReadAsString)
- If you set numberReadAsString is true, then any number will be maintained
as a String.
- Parameters:
in
- input ReadernumberReadAsString
- true if numbers should be interpreted to
Strings
token
public java.lang.Object token()
- Returns:
- the next object read from the stream.
tokenAfterComma
protected java.lang.Object tokenAfterComma()
- Return the next object read from the stream, called if a comma is found
first in order to catch empty fields accurately.
main
public static void main(java.lang.String[] args)
Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details