com.partnersoft.v3x.io.formats.csv
Class CSVDataRecordSource

java.lang.Object
  extended by com.partnersoft.v3x.data.DataRecordSource
      extended by com.partnersoft.v3x.io.formats.record.StreamingDataRecordSource
          extended by com.partnersoft.v3x.io.formats.csv.CSVDataRecordSource
All Implemented Interfaces:
java.io.Serializable

public class CSVDataRecordSource
extends StreamingDataRecordSource
implements java.io.Serializable

A source for data records, derived from a csv stream.

See Also:
Serialized Form

Field Summary
 boolean shutUpAlready
           
 
Fields inherited from class com.partnersoft.v3x.data.DataRecordSource
iteratorWrapper, mapWrapper, parameters, showProgress, verbose
 
Constructor Summary
CSVDataRecordSource()
           
CSVDataRecordSource(java.io.File filet)
           
CSVDataRecordSource(java.lang.String path)
           
 
Method Summary
 void close()
          Do any cleanup needed.
protected  void copyStateFrom(java.lang.Object nother)
           
 java.util.ArrayList getCSVFields()
           
 java.lang.String getCSVType()
           
protected  void initialize(java.util.ArrayList fieldNames)
          Populates the fieldNames list via the first line in the CSV file.
static void main(java.lang.String[] argv)
           
protected  boolean nextRecord(java.util.ArrayList fillThis)
          Subclasses must implement this to set the current values in the given arraylist.
 void setCSVFields(java.util.ArrayList newFields)
           
 void setCSVType(java.lang.String newType)
           
 java.lang.String toString()
           
 
Methods inherited from class com.partnersoft.v3x.io.formats.record.StreamingDataRecordSource
createInputStream, getPath, getPaths, setInputStream, setPath, setPaths
 
Methods inherited from class com.partnersoft.v3x.data.DataRecordSource
asIterator, asMap, clear, clone, containsKey, containsValue, entrySet, fieldNames, fieldValues, get, getAfterActions, getBeforeActions, getContentsMap, getParameters, getPosition, getShowProgress, getTransforms, getTransformScript, hasNext, initialize, isEmpty, isVerbose, keySet, next, put, putAll, remove, remove, reset, setAfterActions, setBeforeActions, setParameters, setShowProgress, setTransforms, setTransformScript, setVerbose, size, values
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

shutUpAlready

public boolean shutUpAlready
Constructor Detail

CSVDataRecordSource

public CSVDataRecordSource()

CSVDataRecordSource

public CSVDataRecordSource(java.lang.String path)

CSVDataRecordSource

public CSVDataRecordSource(java.io.File filet)
Method Detail

main

public static void main(java.lang.String[] argv)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

initialize

protected void initialize(java.util.ArrayList fieldNames)
Populates the fieldNames list via the first line in the CSV file.

Specified by:
initialize in class DataRecordSource

nextRecord

protected boolean nextRecord(java.util.ArrayList fillThis)
Description copied from class: DataRecordSource
Subclasses must implement this to set the current values in the given arraylist. While this does require pulling all values from e.g. a ResultSet, it prevents oddities such as the can-only-fetch-once bug in MSAccess. The list will already be populated with values, so set(index, value) will work for all indices (assuming your record is the same size as the fieldNames list, of course). It is not nulled out, so be sure to set all values. This is done as a prefetch; return true if the prefetch succeeds.

Specified by:
nextRecord in class DataRecordSource

close

public void close()
Description copied from class: DataRecordSource
Do any cleanup needed. Be sure to call super.close().

Overrides:
close in class DataRecordSource

getCSVFields

public java.util.ArrayList getCSVFields()

setCSVFields

public void setCSVFields(java.util.ArrayList newFields)

getCSVType

public java.lang.String getCSVType()

setCSVType

public void setCSVType(java.lang.String newType)

copyStateFrom

protected void copyStateFrom(java.lang.Object nother)
Overrides:
copyStateFrom in class StreamingDataRecordSource