com.northconcepts.datapipeline.csv
Class CSVReader

java.lang.Object
  extended by com.northconcepts.datapipeline.core.DataEndpoint
      extended by com.northconcepts.datapipeline.core.DataReader
          extended by com.northconcepts.datapipeline.core.AbstractReader
              extended by com.northconcepts.datapipeline.core.TextReader
                  extended by com.northconcepts.datapipeline.csv.CSVReader

public class CSVReader
extends TextReader

Obtains records from a Comma Separated Value (CSV) stream.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.northconcepts.datapipeline.core.DataEndpoint
DataEndpoint.State
 
Field Summary
 
Fields inherited from class com.northconcepts.datapipeline.core.TextReader
EOF, reader
 
Fields inherited from class com.northconcepts.datapipeline.core.AbstractReader
currentRecord, fieldNames, lastRow, startingRow
 
Fields inherited from class com.northconcepts.datapipeline.core.DataEndpoint
BUFFER_SIZE, log
 
Constructor Summary
CSVReader(File file)
           
CSVReader(Reader reader)
           
 
Method Summary
 DataException addExceptionProperties(DataException exception)
          Adds this endpoint's current state to a DataException.
protected  boolean fillRecord(Record record)
           
 char getFieldSeparator()
           
 String getNewLine()
           
 char getQuoteChar()
           
 boolean isAllowMultiLineText()
           
 boolean isTrimFields()
           
static Record parse(String line, char fieldSeparator, char quoteChar, boolean allowMultiLineText)
          Utility method to quickly parse a line of text.
 CSVReader setAllowMultiLineText(boolean allowMultiLineText)
           
 CSVReader setFieldSeparator(char columnSeparator)
           
 CSVReader setNewLine(String newLine)
           
 CSVReader setQuoteChar(char quoteChar)
           
 CSVReader setTrimFields(boolean trimFields)
           
 
Methods inherited from class com.northconcepts.datapipeline.core.TextReader
available, close, open, readImpl
 
Methods inherited from class com.northconcepts.datapipeline.core.AbstractReader
getFieldNames, getLastRow, getStartingRow, isFieldNamesInFirstRow, read, setFieldNames, setFieldNamesInFirstRow, setLastRow, setStartingRow
 
Methods inherited from class com.northconcepts.datapipeline.core.DataReader
getBufferSize, getNestedReader, getRootReader, peek, pop, push, skip
 
Methods inherited from class com.northconcepts.datapipeline.core.DataEndpoint
assertNotOpened, assertOpened, decrementRecordCount, exception, exception, exception, finalize, getRecordCount, getRecordCountAsBigInteger, getRecordCountAsString, getState, incrementRecordCount, isClosed, isOpen, isRecordCountBigInteger, resetRecordCount, toString
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CSVReader

public CSVReader(File file)

CSVReader

public CSVReader(Reader reader)
Method Detail

parse

public static Record parse(String line,
                           char fieldSeparator,
                           char quoteChar,
                           boolean allowMultiLineText)
Utility method to quickly parse a line of text.

Parameters:
line - the delimited line of text to parse
fieldSeparator -
quoteChar -
allowMultiLineText -
Returns:

getFieldSeparator

public char getFieldSeparator()

setFieldSeparator

public CSVReader setFieldSeparator(char columnSeparator)

getQuoteChar

public char getQuoteChar()

setQuoteChar

public CSVReader setQuoteChar(char quoteChar)

getNewLine

public String getNewLine()

setNewLine

public CSVReader setNewLine(String newLine)

isAllowMultiLineText

public boolean isAllowMultiLineText()

setAllowMultiLineText

public CSVReader setAllowMultiLineText(boolean allowMultiLineText)

isTrimFields

public boolean isTrimFields()

setTrimFields

public CSVReader setTrimFields(boolean trimFields)

addExceptionProperties

public DataException addExceptionProperties(DataException exception)
Description copied from class: DataEndpoint
Adds this endpoint's current state to a DataException. Since this method is called whenever an exception is thrown, subclasses should override it to add their specific information.

Overrides:
addExceptionProperties in class TextReader

fillRecord

protected boolean fillRecord(Record record)
                      throws Throwable
Specified by:
fillRecord in class AbstractReader
Throws:
Throwable


Copyright (c) 2007-2009 North Concepts Inc. All Rights Reserved.