org.ofbiz.datafile
Class RecordIterator

java.lang.Object
  extended by org.ofbiz.datafile.RecordIterator

public class RecordIterator
extends java.lang.Object

Record Iterator for reading large files


Field Summary
protected  java.io.BufferedReader br
           
protected  boolean closed
           
protected  java.lang.String curLine
           
protected  Record curRecord
           
protected  java.io.InputStream dataFileStream
           
protected  java.lang.String eof
           
protected  java.lang.String locationInfo
           
protected  ModelDataFile modelDataFile
           
static java.lang.String module
           
protected  java.lang.String nextLine
           
protected  int nextLineNum
           
protected  Record nextRecord
           
 
Constructor Summary
RecordIterator(java.io.InputStream dataFileStream, ModelDataFile modelDataFile, java.lang.String locationInfo)
           
RecordIterator(java.net.URL fileUrl, ModelDataFile modelDataFile)
           
 
Method Summary
 void close()
           
protected static ModelRecord findModelForLine(java.lang.String line, int lineNum, ModelDataFile modelDataFile)
          Searches through the record models to find one with a matching type-code, if no type-code exists that model will always be used if it gets to it
 int getCurrentLineNumber()
           
protected  boolean getNextLine()
           
 boolean hasNext()
           
 Record next()
           
protected  void setupStream(java.io.InputStream dataFileStream, java.lang.String locationInfo)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

module

public static final java.lang.String module

br

protected java.io.BufferedReader br

modelDataFile

protected ModelDataFile modelDataFile

dataFileStream

protected java.io.InputStream dataFileStream

closed

protected boolean closed

locationInfo

protected java.lang.String locationInfo

nextLineNum

protected int nextLineNum

curLine

protected java.lang.String curLine

curRecord

protected Record curRecord

nextLine

protected java.lang.String nextLine

nextRecord

protected Record nextRecord

eof

protected java.lang.String eof
Constructor Detail

RecordIterator

public RecordIterator(java.net.URL fileUrl,
                      ModelDataFile modelDataFile)
               throws DataFileException
Throws:
DataFileException

RecordIterator

public RecordIterator(java.io.InputStream dataFileStream,
                      ModelDataFile modelDataFile,
                      java.lang.String locationInfo)
               throws DataFileException
Throws:
DataFileException
Method Detail

setupStream

protected void setupStream(java.io.InputStream dataFileStream,
                           java.lang.String locationInfo)
                    throws DataFileException
Throws:
DataFileException

getNextLine

protected boolean getNextLine()
                       throws DataFileException
Throws:
DataFileException

getCurrentLineNumber

public int getCurrentLineNumber()

hasNext

public boolean hasNext()

next

public Record next()
            throws DataFileException
Throws:
DataFileException

close

public void close()
           throws DataFileException
Throws:
DataFileException

findModelForLine

protected static ModelRecord findModelForLine(java.lang.String line,
                                              int lineNum,
                                              ModelDataFile modelDataFile)
                                       throws DataFileException
Searches through the record models to find one with a matching type-code, if no type-code exists that model will always be used if it gets to it

Parameters:
line -
lineNum -
modelDataFile -
Returns:
Throws:
DataFileException - Exception thown for various errors, generally has a nested exception