+ # Read all the lines until the eof.
+ #
+ # The line terminator '\n' and `\r\n` is removed in each line,
+ #
+ # ~~~
+ # var txt = "Hello\n\nWorld\n"
+ # var i = new StringIStream(txt)
+ # assert i.read_lines == ["Hello", "", "World"]
+ # ~~~
+ #
+ # This method is more efficient that splitting
+ # the result of `read_all`.
+ #
+ # NOTE: SEE `read_line` for details.
+ fun read_lines: Array[String]
+ do
+ var res = new Array[String]
+ while not eof do
+ res.add read_line
+ end
+ return res
+ end
+
+ # Return an iterator that read each line.
+ #
+ # The line terminator '\n' and `\r\n` is removed in each line,
+ # The line are read with `read_line`. See this method for details.
+ #
+ # ~~~
+ # var txt = "Hello\n\nWorld\n"
+ # var i = new StringIStream(txt)
+ # assert i.each_line.to_a == ["Hello", "", "World"]
+ # ~~~
+ #
+ # Unlike `read_lines` that read all lines at the call, `each_line` is lazy.
+ # Therefore, the stream should no be closed until the end of the stream.
+ #
+ # ~~~
+ # i = new StringIStream(txt)
+ # var el = i.each_line
+ #
+ # assert el.item == "Hello"
+ # el.next
+ # assert el.item == ""
+ # el.next
+ #
+ # i.close
+ #
+ # assert not el.is_ok
+ # # closed before "world" is read
+ # ~~~
+ fun each_line: LineIterator do return new LineIterator(self)
+