Package ucar.ma2
Class StructureDataIteratorMediated
- java.lang.Object
-
- ucar.ma2.StructureDataIteratorMediated
-
- All Implemented Interfaces:
Closeable,AutoCloseable,StructureDataIterator
public class StructureDataIteratorMediated extends Object implements StructureDataIterator
Read a maximum number of StructureData objects from a StructureDataIterator.- Since:
- 7/9/2014
-
-
Constructor Summary
Constructors Constructor Description StructureDataIteratorMediated(StructureDataIterator org, StructureDataMediator mod)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Make sure that the iterator is complete, and recover resources.intgetCurrentRecno()booleanhasNext()See if theres more StructureData in the iteration.StructureDatanext()Get the next StructureData in the iteration.StructureDataIteratorreset()Start the iteration over again.voidsetBufferSize(int bytes)Hint to use this much memory in buffering the iteration.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface ucar.ma2.StructureDataIterator
finish
-
-
-
-
Constructor Detail
-
StructureDataIteratorMediated
public StructureDataIteratorMediated(StructureDataIterator org, StructureDataMediator mod)
-
-
Method Detail
-
next
public StructureData next() throws IOException
Description copied from interface:StructureDataIteratorGet the next StructureData in the iteration.- Specified by:
nextin interfaceStructureDataIterator- Returns:
- next StructureData record.
- Throws:
IOException- on read error
-
hasNext
public boolean hasNext() throws IOExceptionDescription copied from interface:StructureDataIteratorSee if theres more StructureData in the iteration. You must always call this before calling next().- Specified by:
hasNextin interfaceStructureDataIterator- Returns:
- true if more records are available
- Throws:
IOException- on read error
-
reset
public StructureDataIterator reset()
Description copied from interface:StructureDataIteratorStart the iteration over again.- Specified by:
resetin interfaceStructureDataIterator- Returns:
- a new or reset iterator.
-
setBufferSize
public void setBufferSize(int bytes)
Description copied from interface:StructureDataIteratorHint to use this much memory in buffering the iteration. No guarentee that it will be used by the implementation.- Specified by:
setBufferSizein interfaceStructureDataIterator- Parameters:
bytes- amount of memory in bytes
-
getCurrentRecno
public int getCurrentRecno()
- Specified by:
getCurrentRecnoin interfaceStructureDataIterator
-
close
public void close()
Description copied from interface:StructureDataIteratorMake 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- Specified by:
closein interfaceStructureDataIterator
-
-