to.etc.csv
Class CSVRecordReader

java.lang.Object
  extended by to.etc.csv.CSVRecordReader
All Implemented Interfaces:
iRecordReader

public class CSVRecordReader
extends java.lang.Object
implements iRecordReader

Reads CSV files record by record, and implements the iLoadInputProvider interface to access the fields. Created on Oct 13, 2003

Author:
jal

Constructor Summary
CSVRecordReader()
           
 
Method Summary
 void addFieldSeparator(java.lang.String sep)
           
 void close()
           
 void defineFields(java.lang.String fields)
          Defines fieldnames using a comma or semicolon separated field name string.
 iInputField find(java.lang.String name)
          Locates the specified field in the current record.
 int getCurrentRecNr()
           
 iInputField getField(int ix)
           
 int getIntValue(java.lang.String name)
           
 int getIntValue(java.lang.String name, int def)
           
 java.lang.String getLine()
           
 long getLongValue(java.lang.String name)
           
 long getLongValue(java.lang.String name, long def)
           
 java.lang.String getValue(int ix)
           
 java.lang.String getValue(java.lang.String name)
           
 boolean isEmptyLine()
           
 boolean nextRecord()
          Read the next (or first) record from the input and prepare it for processing.
 void open(java.io.Reader r, java.lang.String name)
           
 void setEscapeBackslash(boolean escapeBackslash)
           
 void setEscapeBadly(boolean escapeBadly)
           
 void setEscapeDupQuote(boolean escapeDupQuote)
           
 void setFieldSeparator(java.lang.String sep)
           
 void setIgnoreQuotes(boolean ignoreQuotes)
           
 void setSkipWhitespace(boolean skip_ws)
          When T, whitespace between fields is skipped
 void setStartWithFieldNames(boolean startWithFieldNames)
           
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CSVRecordReader

public CSVRecordReader()
Method Detail

open

public void open(java.io.Reader r,
                 java.lang.String name)
          throws java.lang.Exception
Specified by:
open in interface iRecordReader
Throws:
java.lang.Exception

close

public void close()
           throws java.lang.Exception
Specified by:
close in interface iRecordReader
Throws:
java.lang.Exception

getCurrentRecNr

public int getCurrentRecNr()
Specified by:
getCurrentRecNr in interface iRecordReader

setFieldSeparator

public void setFieldSeparator(java.lang.String sep)

addFieldSeparator

public void addFieldSeparator(java.lang.String sep)

setSkipWhitespace

public void setSkipWhitespace(boolean skip_ws)
When T, whitespace between fields is skipped


setIgnoreQuotes

public void setIgnoreQuotes(boolean ignoreQuotes)

setEscapeBackslash

public void setEscapeBackslash(boolean escapeBackslash)

setEscapeDupQuote

public void setEscapeDupQuote(boolean escapeDupQuote)

setStartWithFieldNames

public void setStartWithFieldNames(boolean startWithFieldNames)

setEscapeBadly

public void setEscapeBadly(boolean escapeBadly)

nextRecord

public boolean nextRecord()
                   throws java.io.IOException
Read the next (or first) record from the input and prepare it for processing.

Specified by:
nextRecord in interface iRecordReader
Returns:
Throws:
java.io.IOException

isEmptyLine

public boolean isEmptyLine()

getLine

public final java.lang.String getLine()

defineFields

public void defineFields(java.lang.String fields)
Defines fieldnames using a comma or semicolon separated field name string.

Parameters:
fields -

getField

public iInputField getField(int ix)
Specified by:
getField in interface iRecordReader

size

public int size()
Specified by:
size in interface iRecordReader

find

public iInputField find(java.lang.String name)
Description copied from interface: iRecordReader
Locates the specified field in the current record.

Specified by:
find in interface iRecordReader
Returns:

getValue

public java.lang.String getValue(int ix)

getValue

public java.lang.String getValue(java.lang.String name)

getIntValue

public int getIntValue(java.lang.String name)
                throws java.io.IOException
Throws:
java.io.IOException

getIntValue

public int getIntValue(java.lang.String name,
                       int def)
                throws java.io.IOException
Throws:
java.io.IOException

getLongValue

public long getLongValue(java.lang.String name)
                  throws java.io.IOException
Throws:
java.io.IOException

getLongValue

public long getLongValue(java.lang.String name,
                         long def)
                  throws java.io.IOException
Throws:
java.io.IOException