#3866: Make use of new ByteBuf#readString

This commit is contained in:
Outfluencer
2025-07-17 13:14:18 +02:00
committed by GitHub
parent 4cd9a17a40
commit df53053677

View File

@@ -129,8 +129,7 @@ public abstract class DefinedPacket
throw new OverflowPacketException( "Cannot receive string longer than " + maxLen * 3 + " (got " + len + " bytes)" ); throw new OverflowPacketException( "Cannot receive string longer than " + maxLen * 3 + " (got " + len + " bytes)" );
} }
String s = buf.toString( buf.readerIndex(), len, StandardCharsets.UTF_8 ); String s = buf.readString( len, StandardCharsets.UTF_8 );
buf.readerIndex( buf.readerIndex() + len );
if ( s.length() > maxLen ) if ( s.length() > maxLen )
{ {