coWrite

suspend fun AsynchronousFileChannel.coWrite(src: ByteBuffer, position: Long): Int

Writes the content of the given src ByteBuffer to this AsynchronousFileChannel at the specified position using a coroutine-friendly API.

Return

The number of bytes written.

Example usage:

val channel: AsynchronousFileChannel = ...
val buffer: ByteBuffer = ...
val bytesWritten = channel.coWrite(buffer, 0)

Parameters

src

The source ByteBuffer to be written to the channel.

position

The position in the file at which the writing starts.