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

tryWrite

abstract fun tryWrite(src: ByteBuffer): Int (source)

Writes a sequence of bytes to this channel from the given buffer, if the channel is ready for writing.

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, possibly zero.