net-coroutines / org.apache.tuweni.net.coroutines / WritableCoroutineByteChannel / write

write

abstract suspend fun write(src: ByteBuffer): Int (source)

Writes a sequence of bytes to this channel from the given buffer.

This method will suspend until some bytes can be written to the channel, or an error occurs.

Parameters

src - The buffer from which bytes are to be retrieved.

Exceptions

NonWritableChannelException - If this channel was not opened for writing.

ClosedChannelException - If the channel is closed.

AsynchronousCloseException - If another thread closes this channel while the write operation is in progress.

ClosedByInterruptException - If another thread interrupts the current thread while the write operation is in progress, thereby closing the channel and setting the current thread's interrupt status.

IOException - If some other I/O error occurs.

Return
The number of bytes written.