readLine

suspend fun ByteReadChannel.readLine(lineEnding: LineEnding = LineEnding.Default): String?(source)

Reads a UTF-8-encoded line and returns its decoded text.

Reads and decodes bytes until a line delimiter is found or the channel is exhausted. If content has been read, channel exhaustion also terminates the line; a trailing line delimiter is not required. Line delimiter bytes are not included in the decoded line.

Report a problem

Return

the decoded line, or null if the channel is exhausted before a line can be read

Parameters

lineEnding

line-ending mode. Accepts LF and CRLF by default.