com.partnersoft.formats.csv
Class CsvDataRecordSource

java.lang.Object
  extended by com.partnersoft.io.AbstractIterableInput<Naming<java.lang.Object>>
      extended by com.partnersoft.io.DataRecordSource
          extended by com.partnersoft.formats.text.LineTextDataRecordSource
              extended by com.partnersoft.formats.csv.CsvDataRecordSource
All Implemented Interfaces:
Coggable, IterableInput<Naming<java.lang.Object>>, java.lang.Iterable<Naming<java.lang.Object>>

public class CsvDataRecordSource
extends LineTextDataRecordSource

A comma-separated, line-delimited text data record source.

Copyright 2001-2007 Partner Software, Inc.

Version:
$Id: CsvDataRecordSource.java 2474 2010-03-13 14:28:43Z paul $
Author:
Paul Reavis

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.partnersoft.io.IterableInput
IterableInput.Status
 
Field Summary
 
Fields inherited from class com.partnersoft.formats.text.LineTextDataRecordSource
currentLine, currentLineNumber
 
Fields inherited from class com.partnersoft.io.DataRecordSource
currentValues, fieldNames, verbose
 
Constructor Summary
CsvDataRecordSource()
           
CsvDataRecordSource(Cog state)
           
CsvDataRecordSource(java.lang.String path)
           
CsvDataRecordSource(VfsFile file)
           
CsvDataRecordSource(VfsFile file, java.util.List<java.lang.String> fieldNames)
           
CsvDataRecordSource(VfsFile file, java.lang.String... fieldNames)
           
 
Method Summary
 DataRecordSource copy()
          Makes a copy of this DataRecordSource, that you can iterate over separately.
 void openImp()
          Subclass implementation of guts of open() method.
 boolean parseLine(java.lang.String line)
          Subclasses must implement this.
 
Methods inherited from class com.partnersoft.formats.text.LineTextDataRecordSource
closeImp, fetchImp, getFile, open, readLine
 
Methods inherited from class com.partnersoft.io.DataRecordSource
fetch, getCurrentValues, getFetched, getFieldNames, isVerbose, setVerbose, toCog
 
Methods inherited from class com.partnersoft.io.AbstractIterableInput
close, getException, getStatus, isFetchValid, iterator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CsvDataRecordSource

public CsvDataRecordSource()

CsvDataRecordSource

public CsvDataRecordSource(java.lang.String path)
                    throws java.io.IOException
Throws:
java.io.IOException

CsvDataRecordSource

public CsvDataRecordSource(VfsFile file)

CsvDataRecordSource

public CsvDataRecordSource(VfsFile file,
                           java.util.List<java.lang.String> fieldNames)

CsvDataRecordSource

public CsvDataRecordSource(VfsFile file,
                           java.lang.String... fieldNames)

CsvDataRecordSource

public CsvDataRecordSource(Cog state)
Method Detail

openImp

public void openImp()
             throws java.lang.Exception
Description copied from class: AbstractIterableInput
Subclass implementation of guts of open() method.

Subclasses must implement this to do the actual work required by open(). Feel free to throw exceptions; these are caught inside the open() itself and applied to the exception variable. Thus, you can focus on the actual task instead of paperwork.

Overrides:
openImp in class LineTextDataRecordSource
Throws:
java.lang.Exception

parseLine

public boolean parseLine(java.lang.String line)
                  throws java.lang.Exception
Description copied from class: LineTextDataRecordSource
Subclasses must implement this. It should read the input string, representing a single line of input, set the currentValues array in DataRecordSource, and return true if successful.

Specified by:
parseLine in class LineTextDataRecordSource
Returns:
Throws:
java.lang.Exception

copy

public DataRecordSource copy()
Description copied from class: DataRecordSource
Makes a copy of this DataRecordSource, that you can iterate over separately.

Specified by:
copy in class DataRecordSource
Returns:
copy of this source