Class IOIteratorAdapter<E>

  • Type Parameters:
    E - the type of the stream elements.
    All Implemented Interfaces:
    IOIterator<E>

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

      Fields 
      Modifier and Type Field Description
      private java.util.Iterator<E> delegate  
    • Constructor Summary

      Constructors 
      Constructor Description
      IOIteratorAdapter​(java.util.Iterator<E> delegate)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) static <E> IOIteratorAdapter<E> adapt​(java.util.Iterator<E> delegate)
      Adapts the given Iterator as an IOIterator.
      boolean hasNext()
      Like Iterator.hasNext().
      E next()
      Like Iterator.next().
      java.util.Iterator<E> unwrap()
      Unwraps this instance and returns the underlying Iterator.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • delegate

        private final java.util.Iterator<E> delegate
    • Constructor Detail

      • IOIteratorAdapter

        IOIteratorAdapter​(java.util.Iterator<E> delegate)
    • Method Detail

      • adapt

        static <E> IOIteratorAdapter<E> adapt​(java.util.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 java.io.IOException
        Description copied from interface: IOIterator
        Like Iterator.hasNext().
        Specified by:
        hasNext in interface IOIterator<E>
        Returns:
        See delegate.
        Throws:
        java.io.IOException - if an I/O error occurs.
      • next

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

        public java.util.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.