RemoteIterators.WrappingRemoteIterator (Apache Hadoop Common 3.5.0 API)
Description: declaration: package: org.apache.hadoop.util.functional, class: RemoteIterators, class: WrappingRemoteIterator

Package org.apache.hadoop.util.functional

# 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 Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `WrappingRemoteIterator(RemoteIterator<S> source)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  `IOStatistics`
  `getIOStatistics()`
  Return a statistics instance.
  `protected RemoteIterator<S>`
  `getSource()`
  `protected boolean`
  `sourceHasNext()`
  Check for the source having a next element.
  `protected S`
  `sourceNext()`
  Get the next source value.
  `String`
  `toString()`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface org.apache.hadoop.fs.RemoteIterator

  `hasNext, next`

- ## 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`