JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.util
Class JCCSVParser

java.lang.Object
  |
  +--com.klg.jclass.util.JCCSVParser

public class JCCSVParser
extends Object

Utility class for loading comma-separated values. Given a stream of the format:

  token1, token2
  token3, token4
 
This class is capapble of loading the stream into a vector of vectors.


Field Summary
protected  StreamTokenizer tokenizer
          The stream tokenizer used to read the data.
 
Constructor Summary
JCCSVParser()
           
 
Method Summary
protected  void initTokenizer(Reader r)
          Configures the tokenizer to read the CSV stream.
 int readAndParse(Reader r, Vector vv)
          This method reads the stream provided by r and puts the parsed contents into the Vector vv.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tokenizer

protected StreamTokenizer tokenizer
The stream tokenizer used to read the data.

Constructor Detail

JCCSVParser

public JCCSVParser()
Method Detail

initTokenizer

protected void initTokenizer(Reader r)
Configures the tokenizer to read the CSV stream. Important settings include whitespaceChars, which denotes "," as a whitespace character. This is important because StreamTokenizer uses whitespace as a token delimiter. Also important is the eolIsSignificant() setting of true. This returns EOL as a token that we can use to identify a new row of data.

Parameters:
r -

readAndParse

public int readAndParse(Reader r,
                        Vector vv)
                 throws IOException
This method reads the stream provided by r and puts the parsed contents into the Vector vv.

Parameters:
r - an input reader
vv - a Vector instance; if this is null, no parsing will occur
Returns:
Throws:
IOException

Copyright © 2004 Quest Software Inc..
All rights reserved.