gov.lanl.Utility
Class CSV

java.lang.Object
  |
  +--gov.lanl.Utility.CSV

public class CSV
extends java.lang.Object

 

Field Summary
static char DEFAULT_SEP
           
protected  char fieldSep
          the separator char for this parser
protected  java.util.ArrayList list
          The fields in the current String
 
Constructor Summary
CSV()
          Construct a CSV parser, with the default separator (`,').
CSV(char sep)
          Construct a CSV parser with a given separator.
 
Method Summary
protected  int advPlain(java.lang.String s, java.lang.StringBuffer sb, int i)
          advPlain: unquoted field; return index of next separator
protected  int advQuoted(java.lang.String s, java.lang.StringBuffer sb, int i)
          advQuoted: quoted field; return index of next separator
 java.util.List parse(java.lang.String line)
          parse: break the input String into fields
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SEP

public static final char DEFAULT_SEP
See Also:
Constant Field Values

list

protected java.util.ArrayList list
The fields in the current String


fieldSep

protected char fieldSep
the separator char for this parser

Constructor Detail

CSV

public CSV()
Construct a CSV parser, with the default separator (`,').


CSV

public CSV(char sep)
Construct a CSV parser with a given separator. Must be exactly the string that is the separator, not a list of separator characters!

Method Detail

parse

public java.util.List parse(java.lang.String line)
parse: break the input String into fields

Returns:
java.util.Iterator containing each field from the original as a String, in order.

advQuoted

protected int advQuoted(java.lang.String s,
                        java.lang.StringBuffer sb,
                        int i)
advQuoted: quoted field; return index of next separator


advPlain

protected int advPlain(java.lang.String s,
                       java.lang.StringBuffer sb,
                       int i)
advPlain: unquoted field; return index of next separator