GzipByteReadChannel

Wraps the SdkByteReadChannel so that it compresses into gzip format with each read.

actual class GzipByteReadChannel

Wraps the SdkByteReadChannel so that it compresses into gzip format with each read.

Constructors

Link copied to clipboard
expect constructor(channel: SdkByteReadChannel)
actual constructor(channel: <Error class: unknown class>)

Properties

Link copied to clipboard
expect open override val availableForRead: Int

Returns number of bytes that can be read without suspension. Read operations do no suspend and return immediately when this number is at least the number of bytes requested for read.

actual open val availableForRead: Int
Link copied to clipboard
expect open override val closedCause: Throwable?

Returns the underlying cause the channel was closed with or null if closed successfully or not yet closed. A failed channel will have a closed cause.

Link copied to clipboard
expect open override val isClosedForRead: Boolean

Returns true if the channel is closed and no remaining bytes are available for read. It implies that availableForRead is zero.

actual open val isClosedForRead: Boolean
Link copied to clipboard
expect open override val isClosedForWrite: Boolean

Returns true if the channel is closed from the writer side. availableForRead may be 0

Functions

Link copied to clipboard
expect open override fun cancel(cause: Throwable?): Boolean

Close channel with optional cause cancellation. This is an idempotent operation — subsequent invocations of this function have no effect and return false

actual open fun cancel(cause: Throwable?): Boolean
Link copied to clipboard
expect open suspend override fun read(sink: SdkBuffer, limit: Long): Long

Remove at least 1 byte, and up-to limit bytes from this and appends them to sink. Suspends if no bytes are available. Returns the number of bytes read, or -1 if this channel is exhausted. It is not safe to modify sink until this function returns

actual open suspend fun read(sink: SdkBuffer, limit: Long): Long

Inherited functions

Link copied to clipboard

Read all bytes from this channel into sink. Returns the total number of bytes written.

Link copied to clipboard
suspend fun SdkByteReadChannel.readFully(sink: SdkBuffer, byteCount: Long)

Read exactly byteCount bytes from this into sink or throws EOFException if the channel is exhausted before all bytes could be read.

Link copied to clipboard

Caution Read the entire contents of the channel into sink. This function will suspend until the channel is exhausted and no bytes remain OR the channel cancelled

Link copied to clipboard

Caution Read the entire contents of the channel into a new buffer and return it. This function will suspend until the channel is exhausted and no bytes remain OR the channel cancelled