Files
libmc/src/nativeMain/kotlin/cn/rtast/mcping/platform/buffer.native.kt
T

24 lines
703 B
Kotlin
Raw Normal View History

2026-09-03 19:32:46 +08:00
/*
* Copyright © 2026 RTAkland
* Author: RTAkland
* Date: 2026/9/3
*/
package cn.rtast.mcping.platform
import kotlinx.io.Buffer
import kotlinx.io.readByteArray
internal actual class PlatformBuffer actual constructor() {
private val _delegateBuf = Buffer()
actual fun writeByte(value: Byte) = _delegateBuf.writeByte(value)
actual fun writeBytes(bytes: ByteArray) = _delegateBuf.write(bytes)
actual fun readByte(): Byte = _delegateBuf.readByte()
actual fun readBytes(length: Int): ByteArray = _delegateBuf.readByteArray(length)
actual fun toByteArray(): ByteArray = _delegateBuf.peek().readByteArray()
actual val size: Int
get() = _delegateBuf.size.toInt()
}