com.partnersoft.v3x.io.formats.record
Class FixedRecordDelimitedFieldDataRecordSource

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.record.FixedRecordDelimitedFieldDataRecordSource

public class FixedRecordDelimitedFieldDataRecordSource
extends StreamingDataRecordSource

A DataRecordSource that returns results from a stream of (mostly) ASCII data that is arranged in fixed-width, non-delimited records, but whose fields are delimited in some fashion (and possibly padded with whitespace too you bet). One example is the Porche GLPRINT.SAV file.


Field Summary
 
Fields inherited from class com.partnersoft.v3x.data.DataRecordSource
iteratorWrapper, mapWrapper, parameters, showProgress, verbose
 
Constructor Summary
FixedRecordDelimitedFieldDataRecordSource()
           
 
Method Summary
 void close()
          Do any cleanup needed.
 java.util.ArrayList getBinaryRegions()
           
 byte getDelimiter()
           
 java.util.ArrayList getFieldNames()
           
 int getRecordWidth()
           
 java.util.Map getShortFields()
           
protected  void initialize(java.util.ArrayList fieldNames)
          Subclasses must implement this to set themselves up and populate the fieldNames list.
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 setBinaryRegions(java.util.ArrayList newRegions)
           
 void setDelimiter(byte newDelim)
           
 void setFieldNames(java.util.ArrayList newNames)
           
 void setRecordWidth(int newWidth)
           
 void setShortFields(java.util.Map newFields)
           
 
Methods inherited from class com.partnersoft.v3x.io.formats.record.StreamingDataRecordSource
copyStateFrom, 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, toString, wait, wait, wait
 

Constructor Detail

FixedRecordDelimitedFieldDataRecordSource

public FixedRecordDelimitedFieldDataRecordSource()
Method Detail

initialize

protected void initialize(java.util.ArrayList fieldNames)
Description copied from class: DataRecordSource
Subclasses must implement this to set themselves up and populate the fieldNames list. The list is empty to start with.

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

getRecordWidth

public int getRecordWidth()

setRecordWidth

public void setRecordWidth(int newWidth)

getDelimiter

public byte getDelimiter()

setDelimiter

public void setDelimiter(byte newDelim)

getFieldNames

public java.util.ArrayList getFieldNames()

setFieldNames

public void setFieldNames(java.util.ArrayList newNames)

getBinaryRegions

public java.util.ArrayList getBinaryRegions()

setBinaryRegions

public void setBinaryRegions(java.util.ArrayList newRegions)

getShortFields

public java.util.Map getShortFields()

setShortFields

public void setShortFields(java.util.Map newFields)

main

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