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.
 
 
 
 
openrs2/protocol/src/test/kotlin/org/openrs2/protocol/TestVariableShortPacketCode...

19 lines
616 B

package org.openrs2.protocol
import io.netty.buffer.ByteBuf
import org.openrs2.crypto.StreamCipher
internal object TestVariableShortPacketCodec : VariableShortPacketCodec<VariableShortPacket>(
type = VariableShortPacket::class.java,
opcode = 2
) {
override fun decode(input: ByteBuf, cipher: StreamCipher): VariableShortPacket {
val value = ByteArray(input.readableBytes())
input.readBytes(value)
return VariableShortPacket(value)
}
override fun encode(input: VariableShortPacket, output: ByteBuf, cipher: StreamCipher) {
output.writeBytes(input.value)
}
}