ByteReadChannelBinaryData
Bridge from ktor's ByteReadChannel onto the transport-agnostic RpcBinaryData interface. Lives here (rather than in ksrpc-core) so that ksrpc-core does not publicly depend on ktor — consumers opt in to the ktor-io adapter by adding ksrpc-binary-ktor to their classpath.
Functions
Link copied to clipboard
fun RpcBinaryData.asByteReadChannel(scope: CoroutineScope = CoroutineScope(Dispatchers.Default)): ByteReadChannel
Expose an RpcBinaryData as a ByteReadChannel. Unwraps directly when the underlying data is already a ByteReadChannelBinaryData; otherwise spins up a pump coroutine that drains RpcBinaryData.transferTo into a new ktor ByteChannel.
Link copied to clipboard
open suspend override fun transferTo(sink: suspend (bytes: ByteArray, offset: Int, length: Int) -> Unit)