com.bbn.openmap.util
Class CSVTokenizer

java.lang.Object
  extended by java.io.Reader
      extended by java.io.FilterReader
          extended by java.io.PushbackReader
              extended by com.bbn.openmap.util.Tokenizer
                  extended by 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:


Field Summary
protected  java.lang.Object lastTokened
           
 
Fields inherited from class com.bbn.openmap.util.Tokenizer
EMPTY, EOF, NEWLINE
 
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
 

Field Detail

lastTokened

protected java.lang.Object lastTokened
Constructor Detail

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 Reader
numberReadAsString - true if numbers should be interpreted to Strings
Method Detail

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