ReadableStream

interface ReadableStream

System-independent interface for working with data streams.

Operations on this stream cannot be invoked concurrently.

See also

use

Properties

Link copied to clipboard
abstract var currentOffset: UInt

Number of already read bytes.

Functions

Link copied to clipboard
abstract fun close()

Clearing memory and closing handles. After calling this method, all other methods will return ReadableStreamHasClosedException.

Link copied to clipboard
open fun getLength(): UInt

Returns the number of bytes in the stream. If length is unknown, UInt.MAX_VALUE will be returned.

Link copied to clipboard
abstract fun hasNext(): Boolean

Check is there more data in the stream.

Link copied to clipboard
open suspend fun read(): UByte

Reads and returns a byte from the stream, indented by currentOffset.

Link copied to clipboard
abstract suspend fun readAll(): UByteArray

Returns all data in one byte array and closes itself.

Link copied to clipboard
abstract suspend fun readBlock(blockSize: UShort): UByteArray

Reads and returns up to blockSize next bytes from the stream or an empty array if stream has ran out. Result array could has less size if there is less data remains in the stream.

Inheritors

Link copied to clipboard

Extensions