readUTF8LineTo

suspend fun ByteReadChannel.readUTF8LineTo(out: Appendable, max: Int = Int.MAX_VALUE): Boolean(source)

Reads a line of UTF-8 characters to the specified out buffer. It recognizes CR, LF and CRLF as a line delimiter.

Report a problem

Return

true if a new line separator was found or max bytes appended. false if no new line separator and no bytes read.

Parameters

out

the buffer to write the line to

max

the maximum number of characters to read

Throws

if max is reached before encountering a newline or end of input


suspend fun ByteReadChannel.readUTF8LineTo(out: Appendable, max: Int = Int.MAX_VALUE, lineEnding: LineEndingMode = LineEndingMode.Any): Boolean(source)

Reads a line of UTF-8 characters to the specified out buffer. It recognizes the specified line ending as a line delimiter and throws an exception if an unexpected line delimiter is found. By default, all line endings (CR, LF and CRLF) are allowed as a line delimiter.

Report a problem

Return

true if a new line separator was found or max bytes appended. false if no new line separator and no bytes read.

Parameters

out

the buffer to write the line to

max

the maximum number of characters to read

lineEnding

the allowed line endings

Throws

if max is reached before encountering a newline or end of input