readLine
Removes and returns UTF-8 encoded characters up to but not including the next line break. A line break is either "\n"
or "\r\n"
; these characters are not included in the result.
On the end of the stream this method returns null. If the source doesn't end with a line break, then an implicit line break is assumed. Null is returned once the source is exhausted.
Throws
when the source is closed.
when some I/O error occurs.
Samples
import kotlinx.io.*
import kotlin.test.*
fun main() {
//sampleStart
val buffer = Buffer()
buffer.writeString("No new line here.")
assertFailsWith<EOFException> { buffer.readLineStrict() }
assertEquals("No new line here.", buffer.readLine())
buffer.writeString("Line1\n\nLine2")
assertEquals("Line1", buffer.readLineStrict())
assertEquals("\nLine2", buffer.readString())
//sampleEnd
}