Extensions for kotlinx.coroutines.io.ByteWriteChannel

bufferedWriter

fun ByteWriteChannel.bufferedWriter(
    charset: Charset = Charsets.UTF_8
): BufferedWriter

Open a buffered writer to the channel

use

suspend fun ByteWriteChannel.use(
    block: suspend ByteWriteChannel.() -> Unit
): Unit
fun ByteWriteChannel.use(
    block: ByteWriteChannel.() -> Unit
): Unit

Executes block on ByteWriteChannel and close it down correctly whether an exception

write

suspend fun ByteWriteChannel.write(
    string: String,
    charset: Charset = Charsets.UTF_8
): Unit

Write a string in the specified charset

writer

fun ByteWriteChannel.writer(
    charset: Charset = Charsets.UTF_8
): Writer

Open a writer to the channel