mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-17 19:35:00 -04:00
network: fix string writing
This commit is contained in:
parent
d37ef51ca3
commit
0412be8d63
@ -66,8 +66,9 @@ open class OutByteBuffer(open val connection: Connection? = null) {
|
||||
|
||||
fun writeString(string: String) {
|
||||
check(string.length <= ProtocolDefinition.STRING_MAX_LENGTH) { "String max string length exceeded ${string.length} > ${ProtocolDefinition.STRING_MAX_LENGTH}" }
|
||||
writeVarInt(string.length)
|
||||
writeUnprefixedByteArray(string.toByteArray(StandardCharsets.UTF_8))
|
||||
val bytes = string.toByteArray(StandardCharsets.UTF_8)
|
||||
writeVarInt(bytes.size)
|
||||
writeUnprefixedByteArray(bytes)
|
||||
}
|
||||
|
||||
fun writeVarLong(long: Long) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user