Package ucar.ma2

Interface StructureDataIterator

All Superinterfaces:
AutoCloseable, Closeable
All Known Implementing Classes:
ArrayStructure.ArrayStructureIterator, SequenceIterator, StructureDataIteratorLimited, StructureDataIteratorMediated

public interface StructureDataIterator extends Closeable
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 Type
    Method
    Description
    default void
    Make sure that the iterator is complete, and recover resources.
    default void
    Deprecated.
    use close() or try-with-resource
    int
     
    boolean
    See if theres more StructureData in the iteration.
    Get the next StructureData in the iteration.
    Start the iteration over again.
    default void
    setBufferSize(int bytes)
    Hint to use this much memory in buffering the iteration.
  • Method Details

    • hasNext

      boolean hasNext() throws IOException
      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

      StructureData next() throws IOException
      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

      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:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
    • finish

      default void finish()
      Deprecated.
      use close() or try-with-resource