core :: LineIterator :: defaultinit
# Iterator returned by `Reader::each_line`.
# See the aforementioned method for details.
class LineIterator
super CachedIterator[String]
# The original stream
var stream: Reader
redef fun next_item
do
if stream.eof then
if close_on_finish then stream.close
return null
end
return stream.read_line
end
# Close the stream when the stream is at the EOF.
#
# Default is false.
var close_on_finish = false is writable
redef fun finish
do
if close_on_finish then stream.close
end
end
lib/core/stream.nit:484,1--510,3