LineOutputFeed
Scans buffered input and dispatches lines, disregarding line breaks CR (\r), LF (\n), & CRLF (\r\n).
After reading operations are exhausted, calling close will assume any buffered input remaining is terminating and dispatch it as a line, and then dispatch null to indicate End Of Stream.
This is NOT thread safe.
See also
Scans buffered input and dispatches lines, disregarding line breaks CR (\r), LF (\n), & CRLF (\r\n).
After reading operations are exhausted, calling close will assume any buffered input remaining is terminating and dispatch it as a line, and then dispatch null to indicate End Of Stream.
This is NOT thread safe.
e.g. (Jvm)
val feed = ReadBuffer.lineOutputFeed { line ->
println(line ?: "--EOS--")
}
myInputStream.use { iStream ->
val buf = ReadBuffer.allocate()
try {
while(true) {
val read = iStream.read(buf.buf)
if (read == -1) break
feed.onData(buf, read)
}
} finally {
// done reading, dispatch last line
// (if buffered), and dispatch null
// to indicate EOS
feed.close()
}
}See also
Scans buffered input and dispatches lines, disregarding line breaks CR (\r), LF (\n), & CRLF (\r\n).
After reading operations are exhausted, calling close will assume any buffered input remaining is terminating and dispatch it as a line, and then dispatch null to indicate End Of Stream.
This is NOT thread safe.
e.g. (Jvm)
val feed = ReadBuffer.lineOutputFeed { line ->
println(line ?: "--EOS--")
}
myInputStream.use { iStream ->
val buf = ReadBuffer.allocate()
try {
while(true) {
val read = iStream.read(buf.buf)
if (read == -1) break
feed.onData(buf, read)
}
} finally {
// done reading, dispatch last line
// (if buffered), and dispatch null
// to indicate EOS
feed.close()
}
}See also
Functions
Consumes data from buf at index 0 until len. Data is parsed into individual lines, dispatching each line to provided lineOutputFeed dispatcher callback.
Consumes data from buf at index 0 until len. Data is parsed into individual lines, dispatching each line to provided lineOutputFeed dispatcher callback.
Consumes data from buf at index 0 until len. Data is parsed into individual lines, dispatching each line to provided lineOutputFeed dispatcher callback.