mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-19 12:25:12 -04:00
fix string reading
This commit is contained in:
parent
f359eb2d49
commit
005f3c0f01
@ -105,7 +105,7 @@ public class InByteBuffer {
|
||||
if (data.length > ProtocolDefinition.STRING_MAX_LEN) {
|
||||
throw new IllegalArgumentException(String.format("String max string length exceeded %d > %d", data.length, ProtocolDefinition.STRING_MAX_LEN));
|
||||
}
|
||||
return new String(readBytes(readVarInt()), StandardCharsets.UTF_8);
|
||||
return new String(data, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
public long readVarLong() {
|
||||
@ -114,7 +114,7 @@ public class InByteBuffer {
|
||||
byte read;
|
||||
do {
|
||||
read = readByte();
|
||||
result |= (read & 0x7F) << (7 * byteCount);
|
||||
result |= (long) (read & 0x7F) << (7 * byteCount);
|
||||
byteCount++;
|
||||
if (byteCount > 10) {
|
||||
throw new IllegalArgumentException("VarLong is too big");
|
||||
|
Loading…
x
Reference in New Issue
Block a user