RpcBinaryData

Transport-agnostic binary data source. Implementations adapt user-facing types (ByteReadChannel, kotlinx.io.Source, okio.BufferedSource, ...) to a shape the ksrpc wire protocol can consume.

Source-oriented only: in ksrpc the binary payload is always "something the receiver reads from," regardless of which side is sending.

Properties

Link copied to clipboard
open val size: Long?

Known byte length, or null for unknown / streaming sources.

Functions

Link copied to clipboard
abstract suspend fun close()
Link copied to clipboard
abstract suspend fun transferTo(sink: suspend (bytes: ByteArray, offset: Int, length: Int) -> Unit)

Pull all bytes from this source into sink. The sink callback may be invoked many times with different offsets / lengths into a buffer the implementation owns; callers must not retain the bytes array beyond the duration of the call.