Class ReplyIterator

  • All Implemented Interfaces:
    java.lang.Iterable<java.lang.String>, java.util.Iterator<java.lang.String>

    final class ReplyIterator
    extends java.lang.Object
    implements java.util.Iterator<java.lang.String>, java.lang.Iterable<java.lang.String>
    Wraps a BufferedReader and returns an Iterable<String> which returns the individual lines from the reader.
    Since:
    3.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String line  
      private java.io.BufferedReader reader  
      private java.lang.Exception savedException  
    • Constructor Summary

      Constructors 
      Constructor Description
      ReplyIterator​(java.io.BufferedReader _reader)  
      ReplyIterator​(java.io.BufferedReader _reader, boolean addDotReader)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean hasNext()  
      java.util.Iterator<java.lang.String> iterator()  
      java.lang.String next()  
      void remove()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
      • Methods inherited from interface java.util.Iterator

        forEachRemaining
    • Field Detail

      • reader

        private final java.io.BufferedReader reader
      • line

        private java.lang.String line
      • savedException

        private java.lang.Exception savedException
    • Constructor Detail

      • ReplyIterator

        ReplyIterator​(java.io.BufferedReader _reader)
               throws java.io.IOException
        Throws:
        java.io.IOException
      • ReplyIterator

        ReplyIterator​(java.io.BufferedReader _reader,
                      boolean addDotReader)
               throws java.io.IOException
        Parameters:
        _reader - the reader to wrap
        addDotReader - whether to additionally wrap the reader in a DotTerminatedMessageReader
        Throws:
        java.io.IOException
    • Method Detail

      • hasNext

        public boolean hasNext()
        Specified by:
        hasNext in interface java.util.Iterator<java.lang.String>
      • iterator

        public java.util.Iterator<java.lang.String> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<java.lang.String>
      • next

        public java.lang.String next()
                              throws java.util.NoSuchElementException
        Specified by:
        next in interface java.util.Iterator<java.lang.String>
        Throws:
        java.util.NoSuchElementException
      • remove

        public void remove()
        Specified by:
        remove in interface java.util.Iterator<java.lang.String>