Package ucar.ma2
Interface StructureDataIterator
- All Superinterfaces:
AutoCloseable,Closeable
- All Known Implementing Classes:
ArrayStructure.ArrayStructureIterator,SequenceIterator,StructureDataIteratorLimited,StructureDataIteratorMediated
An iterator over StructureData.
Make sure that you call close().
Best to put in a try/finally block like:
try {
while (iter.hasNext())
process(iter.next());
} finally {
iter.finish();
}
- Since:
- Feb 23, 2008
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidclose()Make sure that the iterator is complete, and recover resources.intbooleanhasNext()See if theres more StructureData in the iteration.next()Get the next StructureData in the iteration.reset()Start the iteration over again.default voidsetBufferSize(int bytes) Hint to use this much memory in buffering the iteration.
-
Method Details
-
hasNext
See if theres more StructureData in the iteration. You must always call this before calling next().- Returns:
- true if more records are available
- Throws:
IOException- on read error
-
next
Get the next StructureData in the iteration.- Returns:
- next StructureData record.
- Throws:
IOException- on read error
-
setBufferSize
default void setBufferSize(int bytes) Hint to use this much memory in buffering the iteration. No guarentee that it will be used by the implementation.- Parameters:
bytes- amount of memory in bytes
-
reset
StructureDataIterator reset()Start the iteration over again.- Returns:
- a new or reset iterator.
-
getCurrentRecno
int getCurrentRecno() -
close
default void close()Make sure that the iterator is complete, and recover resources. Best to put in a try/finally block like:try (StructureDataIterator iter = obj.getStructureDataIterator()) { while (iter.hasNext()) process(iter.next()); }- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-