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 void
close()
Make sure that the iterator is complete, and recover resources.int
getCurrentRecno()
boolean
hasNext()
See if theres more StructureData in the iteration.StructureData
next()
Get the next StructureData in the iteration.StructureDataIterator
reset()
Start the iteration over again.void
setBufferSize(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:StructureDataIterator
Get the next StructureData in the iteration.- Specified by:
next
in interfaceStructureDataIterator
- Returns:
- next StructureData record.
- Throws:
IOException
- on read error
-
hasNext
public boolean hasNext() throws IOException
Description copied from interface:StructureDataIterator
See if theres more StructureData in the iteration. You must always call this before calling next().- Specified by:
hasNext
in interfaceStructureDataIterator
- Returns:
- true if more records are available
- Throws:
IOException
- on read error
-
reset
public StructureDataIterator reset()
Description copied from interface:StructureDataIterator
Start the iteration over again.- Specified by:
reset
in interfaceStructureDataIterator
- Returns:
- a new or reset iterator.
-
setBufferSize
public void setBufferSize(int bytes)
Description copied from interface:StructureDataIterator
Hint to use this much memory in buffering the iteration. No guarentee that it will be used by the implementation.- Specified by:
setBufferSize
in interfaceStructureDataIterator
- Parameters:
bytes
- amount of memory in bytes
-
getCurrentRecno
public int getCurrentRecno()
- Specified by:
getCurrentRecno
in interfaceStructureDataIterator
-
close
public void close()
Description copied from interface:StructureDataIterator
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:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceStructureDataIterator
-
-