Open-source multiplayer game server compatible with the RuneScape client https://www.openrs2.org/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

30 lines
645 B

package org.openrs2.protocol.common
import io.netty.buffer.ByteBuf
import io.netty.buffer.ByteBufUtil
public class Uid private constructor(
private val bytes: ByteArray,
) {
init {
require(bytes.size == LENGTH)
}
public fun write(buf: ByteBuf) {
buf.writeBytes(bytes)
}
public override fun toString(): String {
return ByteBufUtil.hexDump(bytes)
}
public companion object {
public const val LENGTH: Int = 24
public fun read(buf: ByteBuf): Uid {
val bytes = ByteArray(LENGTH)
buf.readBytes(bytes)
return Uid(bytes)
}
}
}