lineOutputFeed

actual fun lineOutputFeed(dispatch: (line: String?) -> Unit): ReadBuffer.LineOutputFeed(source)

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()
    }
}

NOTE: dispatch should not throw exception

expect fun lineOutputFeed(dispatch: (line: String?) -> Unit): ReadBuffer.LineOutputFeed(source)

Creates a new LineOutputFeed

NOTE: dispatch should not throw exception

actual fun lineOutputFeed(dispatch: (line: String?) -> Unit): ReadBuffer.LineOutputFeed(source)

Creates a new LineOutputFeed

NOTE: dispatch should not throw exception