eu.gressly.io.csv
Class CSVScanner

java.lang.Object
  extended by eu.gressly.io.csv.CSVScanner

public class CSVScanner
extends java.lang.Object

Split lines from a coma separated values (csv) file. The lines have to be read in advance. This clas does not IO operations. Usually a BufferedInputReader reads the lines and lets them parse by this CSV-Scanner. The separator of entries is a coma (,) but it could be any other character (see second constructor). Values may contain the coma-separator, if only they are qouted ("). To quote quotes, a backslash (\") or a double quote ("") can be used.

Author:
Philipp Gressly (phi@gressly.ch)

Constructor Summary
CSVScanner(java.lang.String line)
          initialize with a single line out of a "csv" file.
CSVScanner(java.lang.String line, char separator)
          Parse a line, which is separated by the given "separator".
 
Method Summary
 java.lang.String nextToken()
          return the next token or "null" for "end of string"
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CSVScanner

public CSVScanner(java.lang.String line)
initialize with a single line out of a "csv" file.

Parameters:
line - to parse.

CSVScanner

public CSVScanner(java.lang.String line,
                  char separator)
Parse a line, which is separated by the given "separator".

Parameters:
line - to parse
separator - to use instead of the default (,)
Method Detail

nextToken

public java.lang.String nextToken()
return the next token or "null" for "end of string"