close

expect abstract fun close(cause: Throwable?): Boolean

Closes this channel with an optional exceptional cause. It flushes all pending write bytes (via flush). This is an idempotent operation -- repeated invocations of this function have no effect and return false.

A channel that was closed without a cause, is considered to be closed normally. A channel that was closed with non-null cause is called a failed channel. Attempts to read or write on a failed channel throw this cause exception.

After invocation of this operation isClosedForWrite starts returning true and all subsequent write operations throw ClosedWriteChannelException or the specified cause. However, isClosedForRead on the side of ByteReadChannel starts returning true only after all written bytes have been read.

Please note that if the channel has been closed with cause and it has been provided by reader or writer coroutine then the corresponding coroutine will be cancelled with cause. If no cause provided then no cancellation will be propagated.

actual abstract fun close(cause: Throwable?): Boolean

Closes this channel with an optional exceptional cause. It flushes all pending write bytes (via flush). This is an idempotent operation -- repeated invocations of this function have no effect and return false.

A channel that was closed without a cause, is considered to be closed normally. A channel that was closed with non-null cause is called a failed channel. Attempts to read or write on a failed channel throw this cause exception.

After invocation of this operation isClosedForWrite starts returning true and all subsequent write operations throw ClosedWriteChannelException or the specified cause. However, isClosedForRead on the side of ByteReadChannel starts returning true only after all written bytes have been read.

Please note that if the channel has been closed with cause and it has been provided by reader or writer coroutine then the corresponding coroutine will be cancelled with cause. If no cause provided then no cancellation will be propagated.

actual abstract fun close(cause: Throwable?): Boolean

Closes this channel with an optional exceptional cause. It flushes all pending write bytes (via flush). This is an idempotent operation -- repeated invocations of this function have no effect and return false.

A channel that was closed without a cause, is considered to be closed normally. A channel that was closed with non-null cause is called a failed channel. Attempts to read or write on a failed channel throw this cause exception.

After invocation of this operation isClosedForWrite starts returning true and all subsequent write operations throw ClosedWriteChannelException or the specified cause. However, isClosedForRead on the side of ByteReadChannel starts returning true only after all written bytes have been read.

Please note that if the channel has been closed with cause and it has been provided by reader or writer coroutine then the corresponding coroutine will be cancelled with cause. If no cause provided then no cancellation will be propagated.

actual abstract fun close(cause: Throwable?): Boolean

Closes this channel with an optional exceptional cause. It flushes all pending write bytes (via flush). This is an idempotent operation -- repeated invocations of this function have no effect and return false.

A channel that was closed without a cause, is considered to be closed normally. A channel that was closed with non-null cause is called a failed channel. Attempts to read or write on a failed channel throw this cause exception.

After invocation of this operation isClosedForWrite starts returning true and all subsequent write operations throw ClosedWriteChannelException or the specified cause. However, isClosedForRead on the side of ByteReadChannel starts returning true only after all written bytes have been read.

Please note that if the channel has been closed with cause and it has been provided by reader or writer coroutine then the corresponding coroutine will be cancelled with cause. If no cause provided then no cancellation will be propagated.