inline suspend fun ByteWriteChannel.write(desiredSpace: Int = 1, block: (freeSpace: Memory, startOffset: Long, endExclusive: Long) -> Int): Int

Await for desiredSpace will be available for write and invoke block function providing Memory instance and the corresponding range suitable for wiring in the memory. The block function should return number of bytes were written, possibly 0.

Similar to ByteReadChannel.read, this function may invoke block function with lesser memory range when the specified desiredSpace is bigger that the buffer's capacity or when it is impossible to represent all desiredSpace bytes as a single memory range due to internal implementation reasons.