org.kuali.kfs.module.ld.util
Class LaborOriginEntryFileIterator
java.lang.Object
org.kuali.kfs.module.ld.util.LaborOriginEntryFileIterator
- All Implemented Interfaces:
- Iterator<LaborOriginEntry>
- Direct Known Subclasses:
- FilteringLaborOriginEntryFileIterator
public class LaborOriginEntryFileIterator
- extends Object
- implements Iterator<LaborOriginEntry>
This class lazy loads the origin entries in a flat file. This implementation uses a limited amount of memory because it does not
pre-load all of the origin entries at once. (Assuming that the Java garbage collector is working well). However, if the code that
uses this iterator stores the contents of this iterator in a big list somewhere, then a lot of memory may be consumed, depending
on the size of the file.
nextEntry
protected LaborOriginEntry nextEntry
reader
protected BufferedReader reader
lineNumber
protected int lineNumber
autoCloseReader
protected boolean autoCloseReader
LaborOriginEntryFileIterator
public LaborOriginEntryFileIterator(BufferedReader reader)
- Constructs a LaborOriginEntryFileIterator
- Parameters:
reader
- a reader representing flat-file origin entriesautoCloseReader
- whether to automatically close the reader when the end of origin entries has been reached (i.e. when
hasNext() returns false)
LaborOriginEntryFileIterator
public LaborOriginEntryFileIterator(BufferedReader reader,
boolean autoCloseReader)
- Constructs a LaborOriginEntryFileIterator
- Parameters:
reader
- a reader representing flat-file origin entriesautoCloseReader
- whether to automatically close the reader when the end of origin entries has been reached (i.e. when
hasNext() returns false)
LaborOriginEntryFileIterator
public LaborOriginEntryFileIterator(File file)
- Constructs a LaborOriginEntryFileIterator When constructed with this method, the file handle will be automatically closed
when the end of origin entries has been reached (i.e. when hasNext() returns false)
- Parameters:
file
- the file
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interface Iterator<LaborOriginEntry>
- See Also:
Iterator.hasNext()
next
public LaborOriginEntry next()
- Specified by:
next
in interface Iterator<LaborOriginEntry>
- See Also:
Iterator.next()
remove
public void remove()
- Specified by:
remove
in interface Iterator<LaborOriginEntry>
- See Also:
Iterator.remove()
fetchNextEntry
protected void fetchNextEntry()
finalize
protected void finalize()
throws Throwable
- Overrides:
finalize
in class Object
- Throws:
Throwable
- See Also:
Object.finalize()
Copyright © 2005-2012 The Kuali Foundation. All Rights Reserved.