mirai-core / net.mamoe.mirai.utils / kotlinx.coroutines.io.ByteReadChannel

Extensions for kotlinx.coroutines.io.ByteReadChannel

copyAndClose

从接收者管道读取所有数据并写入 dst, 最终关闭 dst

suspend fun ByteReadChannel.copyAndClose(dst: OutputStream): Unit
suspend fun ByteReadChannel.copyAndClose(dst: Output): Unit
suspend fun ByteReadChannel.copyAndClose(dst: ByteWriteChannel): Unit
suspend fun ByteReadChannel.copyAndClose(dst: ByteWriteChannel): Unit

copyTo

从接收者管道读取所有数据并写入 dst. 不会关闭 dst

suspend fun ByteReadChannel.copyTo(dst: OutputStream): Unit
suspend fun ByteReadChannel.copyTo(dst: Output): Unit
suspend fun ByteReadChannel.copyTo(dst: ByteWriteChannel): Unit

toExternalImage

保存为临时文件然后调用 File.toExternalImage.

suspend fun ByteReadChannel.toExternalImage(): ExternalImage