uk.org.ogsadai.converters.csv
Class CSVParser

java.lang.Object
  |
  +--uk.org.ogsadai.converters.csv.CSVParser

public class CSVParser
extends java.lang.Object

This class parses a CSV document, pushing the parsed results into a WebRowSetHandler.

Author:
The OGSA-DAI Team.

Nested Class Summary
private  class CSVParser.CSVReader
          Private inner class encapsulating data structure used by the parsing algorithm.
 
Field Summary
private static java.lang.String COPYRIGHT_NOTICE
           
private  boolean dblQuoteMayClose
           
private  boolean dblQuoteOpen
           
private  CSVConfigurator mConfigurator
           
private  java.io.Reader mInput
           
private  CSVColumnMetaData mMetaData
           
private  CSVHandler mOutput
           
 
Constructor Summary
CSVParser()
           
 
Method Summary
 void parse()
          Starts parsing the CSV File.
 void setConfigurator(CSVConfigurator configurator)
          Set the CSV file format configurator.
 void setInput(java.io.Reader reader)
          Set the input source of the parser that provides the CSV file.
 void setOutput(CSVHandler handler)
          Set the CSVHandler which handles the parsed data.
private  void storeColumnNames(CSVColumnMetaData metadata, java.util.Vector row)
          Fills metadata object with column names extracted from a row
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT_NOTICE

private static final java.lang.String COPYRIGHT_NOTICE
See Also:
Constant Field Values

dblQuoteOpen

private boolean dblQuoteOpen

dblQuoteMayClose

private boolean dblQuoteMayClose

mInput

private java.io.Reader mInput

mOutput

private CSVHandler mOutput

mConfigurator

private CSVConfigurator mConfigurator

mMetaData

private CSVColumnMetaData mMetaData
Constructor Detail

CSVParser

public CSVParser()
Method Detail

setConfigurator

public void setConfigurator(CSVConfigurator configurator)
Set the CSV file format configurator.

Parameters:
configurator - describing file format.
See Also:
CSVConfigurator

setInput

public void setInput(java.io.Reader reader)
Set the input source of the parser that provides the CSV file.

Parameters:
reader - CSV data source.

setOutput

public void setOutput(CSVHandler handler)
Set the CSVHandler which handles the parsed data.

Parameters:
handler - Handler parsed data.

parse

public void parse()
           throws CSVParseException,
                  java.io.IOException,
                  java.sql.SQLException
Starts parsing the CSV File.

Throws:
java.sql.SQLException - if there was a problem with constructing metadata.
CSVParseException - if the CSV file format could not be understood.
java.io.IOException - if there was a problem reading from the input source.

storeColumnNames

private void storeColumnNames(CSVColumnMetaData metadata,
                              java.util.Vector row)
Fills metadata object with column names extracted from a row

Parameters:
metadata - metadata object
row - String vector containing column names