Kotlin: Stream.awaitStreamClose()

DESCRIPTION

Close a stream.

This is meant to be used in a Kotlin coroutine to suspend execution until the Stream is closed.

DECLARATION

suspend fun Stream.awaitStreamClose() 

THROWS EXCEPTIONS

NabtoRuntimeException:
With error code STOPPED if the stream is stopped.
NabtoRuntimeException:
With error code OPERATION_IN_PROGRESS if another stop is in progress.
NabtoRuntimeException:
With error code INVALID_STATE if the stream is not opened yet.