lineOutputFeed
Creates a new LineOutputFeed
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()
}
}
Content copied to clipboard
NOTE: dispatch should not throw exception
Creates a new LineOutputFeed
NOTE: dispatch should not throw exception
Creates a new LineOutputFeed
NOTE: dispatch should not throw exception