lineSequence

fun BufferedReader.lineSequence(): Sequence<String> (source)

Platform and version requirements: JVM

Returns a sequence of corresponding file lines.

Note: the caller must close the underlying BufferedReader when the iteration is finished; as the user may not complete the iteration loop (e.g. using a method like find() or any() on the iterator may terminate the iteration early.

We suggest you try the method useLines instead which closes the stream when the processing is complete.

Return a sequence of corresponding file lines. The sequence returned can be iterated only once.