Class IOIteratorAdapter<E>

java.lang.Object
org.apache.commons.io.function.IOIteratorAdapter<E>
Type Parameters:
E - the type of the stream elements.
All Implemented Interfaces:
IOIterator<E>

final class IOIteratorAdapter<E> extends Object implements IOIterator<E>
Adapts an Iterator as an IOIterator.
  • Field Details

    • delegate

      private final Iterator<E> delegate
  • Constructor Details

    • IOIteratorAdapter

      IOIteratorAdapter(Iterator<E> delegate)
  • Method Details

    • adapt

      static <E> IOIteratorAdapter<E> adapt(Iterator<E> delegate)
      Description copied from interface: IOIterator
      Adapts the given Iterator as an IOIterator.
      Type Parameters:
      E - the type of the stream elements.
      Parameters:
      delegate - The iterator to adapt
      Returns:
      A new IOIterator
    • hasNext

      public boolean hasNext() throws IOException
      Description copied from interface: IOIterator
      Specified by:
      hasNext in interface IOIterator<E>
      Returns:
      See delegate.
      Throws:
      IOException - if an I/O error occurs.
    • next

      public E next() throws IOException
      Description copied from interface: IOIterator
      Specified by:
      next in interface IOIterator<E>
      Returns:
      See delegate.
      Throws:
      IOException - if an I/O error occurs.
    • unwrap

      public Iterator<E> unwrap()
      Description copied from interface: IOIterator
      Unwraps this instance and returns the underlying Iterator.

      Implementations may not have anything to unwrap and that behavior is undefined for now.

      Specified by:
      unwrap in interface IOIterator<E>
      Returns:
      the underlying Iterator.