readLineTo

suspend fun ByteReadChannel.readLineTo(out: Appendable, lineEnding: LineEnding = LineEnding.Default): Long(source)

Reads a UTF-8-encoded line and appends its decoded characters to out.

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 number of bytes read for the line content, or -1 if the channel is exhausted before a line can be read

Parameters

out

the destination to append the decoded line to; the line delimiter is not appended

lineEnding

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