org.relique.jdbc.csv
Class CsvReader

java.lang.Object
  |
  +--org.relique.jdbc.csv.CsvReader

public class CsvReader
extends java.lang.Object

This class is a helper class that handles the reading and parsing of data from a .csv file.

Version:
$Id: CsvReader.java,v 1.10 2003/01/16 09:04:29 tskutnik Exp $
Author:
Jonathan Ackerman, Sander Brienen, Stuart Mottram (fritto), Jason Bedell, Tomasz Skutnik

Field Summary
private  java.lang.String buf
           
private  java.lang.String charset
           
private  java.lang.String[] columnNames
           
private  java.lang.String[] columns
           
private  java.lang.String fileName
           
private  java.io.BufferedReader input
           
private  char separator
           
private  boolean suppressHeaders
           
private  java.lang.String tableName
           
 
Constructor Summary
CsvReader(java.lang.String fileName)
          Constructor for the CsvReader object
CsvReader(java.lang.String fileName, char separator, boolean suppressHeaders, java.lang.String charset)
          Insert the method's description here.
 
Method Summary
 void close()
          Description of the Method
 java.lang.String getColumn(int columnIndex)
          Get the value of the column at the specified index.
 java.lang.String getColumn(java.lang.String columnName)
          Get value from column at specified name.
 java.lang.String[] getColumnNames()
          Gets the columnNames attribute of the CsvReader object
 java.lang.String getTableName()
           
 boolean next()
          Description of the Method
protected  java.lang.String[] parseCsvLine(java.lang.String line)
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

input

private java.io.BufferedReader input

columnNames

private java.lang.String[] columnNames

columns

private java.lang.String[] columns

buf

private java.lang.String buf

separator

private char separator

suppressHeaders

private boolean suppressHeaders

tableName

private java.lang.String tableName

fileName

private java.lang.String fileName

charset

private java.lang.String charset
Constructor Detail

CsvReader

public CsvReader(java.lang.String fileName)
          throws java.lang.Exception
Constructor for the CsvReader object
Parameters:
fileName - Description of Parameter
Throws:
java.lang.Exception - Description of Exception
Since:
 

CsvReader

public CsvReader(java.lang.String fileName,
                 char separator,
                 boolean suppressHeaders,
                 java.lang.String charset)
          throws java.lang.Exception
Insert the method's description here. Creation date: (6-11-2001 15:02:42)
Parameters:
fileName - java.lang.String
separator - char
suppressHeaders - boolean
Throws:
java.lang.Exception - The exception description.
Since:
 
Method Detail

getColumnNames

public java.lang.String[] getColumnNames()
Gets the columnNames attribute of the CsvReader object
Returns:
The columnNames value
Since:
 

getTableName

public java.lang.String getTableName()

getColumn

public java.lang.String getColumn(int columnIndex)
                           throws java.sql.SQLException
Get the value of the column at the specified index.
Parameters:
columnIndex - Description of Parameter
Returns:
The column value
Since:
 

getColumn

public java.lang.String getColumn(java.lang.String columnName)
                           throws java.sql.SQLException
Get value from column at specified name. If the column name is not found, throw an error.
Parameters:
columnName - Description of Parameter
Returns:
The column value
Throws:
java.sql.SQLException - Description of Exception
Since:
 

next

public boolean next()
             throws java.sql.SQLException
Description of the Method
Returns:
Description of the Returned Value
Throws:
java.sql.SQLException - Description of Exception
Since:
 

close

public void close()
Description of the Method
Since:
 

parseCsvLine

protected java.lang.String[] parseCsvLine(java.lang.String line)
                                   throws java.sql.SQLException


Check out http://csvjdbc.sourceforge.net for more info.