asByteWriteChannel
Creates a ByteWriteChannel that writes to this Sink.
Example usage:
suspend fun writeMessage(raw: RawSink) {
val channel = raw.asByteWriteChannel()
channel.writeByte(42)
channel.flushAndClose()
}
val buffer = Buffer()
writeMessage(buffer)
buffer.readByte() // 42
Content copied to clipboard
Please note that the channel will be buffered even if the sink is not.