Class RemoteIterators.WrappingRemoteIterator<S,T>

java.lang.Object
org.apache.hadoop.util.functional.RemoteIterators.WrappingRemoteIterator<S,T>
Type Parameters:
S - source type
T - type of returned value
All Implemented Interfaces:
Closeable, AutoCloseable, RemoteIterator<T>, IOStatisticsSource
Enclosing class:
RemoteIterators

public abstract static class RemoteIterators.WrappingRemoteIterator<S,T> extends Object implements RemoteIterator<T>, IOStatisticsSource, Closeable
Wrapper of another remote iterator; IOStatistics and Closeable methods are passed down if implemented. This class may be subclassed within the hadoop codebase if custom iterators are needed.
  • Constructor Details

    • WrappingRemoteIterator

      protected WrappingRemoteIterator(RemoteIterator<S> source)
  • Method Details

    • getSource

      protected RemoteIterator<S> getSource()
    • getIOStatistics

      public IOStatistics getIOStatistics()
      Description copied from interface: IOStatisticsSource
      Return a statistics instance.

      It is not a requirement that the same instance is returned every time. IOStatisticsSource.

      If the object implementing this is Closeable, this method may return null if invoked on a closed object, even if it returns a valid instance when called earlier.

      Specified by:
      getIOStatistics in interface IOStatisticsSource
      Returns:
      an IOStatistics instance or null
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException
    • sourceHasNext

      protected boolean sourceHasNext() throws IOException
      Check for the source having a next element. If it does not, this object's close() method is called and false returned
      Returns:
      true if there is a new value
      Throws:
      IOException - failure to retrieve next value
    • sourceNext

      protected S sourceNext() throws IOException
      Get the next source value. This calls sourceHasNext() first to verify that there is data.
      Returns:
      the next value
      Throws:
      IOException - failure
      NoSuchElementException - no more data
    • toString

      public String toString()
      Overrides:
      toString in class Object