Class RecordIterator

java.lang.Object
org.apache.ofbiz.datafile.RecordIterator

public class RecordIterator extends Object
Record Iterator for reading large files Note: this is a memory intensive and will not handle files that exceed memory.
  • Constructor Details

  • Method Details

    • setupStream

      protected void setupStream(InputStream dataFileStream, String locationInfo) throws DataFileException
      Sets stream.
      Parameters:
      dataFileStream - the data file stream
      locationInfo - the location info
      Throws:
      DataFileException - the data file exception
    • getNextLine

      protected boolean getNextLine() throws DataFileException
      Gets next line.
      Returns:
      the next line
      Throws:
      DataFileException - the data file exception
    • getCurrentLineNumber

      public int getCurrentLineNumber()
      Gets current line number.
      Returns:
      the current line number
    • hasNext

      public boolean hasNext()
      Has next boolean.
      Returns:
      the boolean
    • next

      public Record next() throws DataFileException
      Next record.
      Returns:
      the record
      Throws:
      DataFileException - the data file exception
    • close

      public void close() throws DataFileException
      Close.
      Throws:
      DataFileException - the data file exception
    • findModelForLine

      protected static ModelRecord findModelForLine(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:
      return the ModelRecord Object found
      Throws:
      DataFileException - Exception thown for various errors, generally has a nested exception