13
0
geforkt von Mirrors/Velocity

Fix Checkstyle issue for the umpteenth time...

Dieser Commit ist enthalten in:
Andrew Steinborn 2021-01-29 17:59:00 -05:00
Ursprung 4f6d238b39
Commit 501853e807

Datei anzeigen

@ -97,22 +97,6 @@ public enum ProtocolUtils {
} }
} }
public static String readString(ByteBuf buf) {
return readString(buf, DEFAULT_MAX_STRING_SIZE);
}
/**
* Reads a VarInt length-prefixed UTF-8 string from the {@code buf}, making sure to not go over
* {@code cap} size.
* @param buf the buffer to read from
* @param cap the maximum size of the string, in UTF-8 character length
* @return the decoded string
*/
public static String readString(ByteBuf buf, int cap) {
int length = readVarInt(buf);
return readString(buf, cap, length);
}
/** /**
* Reads a VarInt length-prefixed ASCII string from the {@code buf}, making sure to not go over * Reads a VarInt length-prefixed ASCII string from the {@code buf}, making sure to not go over
* {@code cap} size. This method is specialized for select parts of the Minecraft protocol where * {@code cap} size. This method is specialized for select parts of the Minecraft protocol where
@ -131,6 +115,22 @@ public enum ProtocolUtils {
return str; return str;
} }
public static String readString(ByteBuf buf) {
return readString(buf, DEFAULT_MAX_STRING_SIZE);
}
/**
* Reads a VarInt length-prefixed UTF-8 string from the {@code buf}, making sure to not go over
* {@code cap} size.
* @param buf the buffer to read from
* @param cap the maximum size of the string, in UTF-8 character length
* @return the decoded string
*/
public static String readString(ByteBuf buf, int cap) {
int length = readVarInt(buf);
return readString(buf, cap, length);
}
private static String readString(ByteBuf buf, int cap, int length) { private static String readString(ByteBuf buf, int cap, int length) {
checkFrame(length >= 0, "Got a negative-length string (%s)", length); checkFrame(length >= 0, "Got a negative-length string (%s)", length);
// `cap` is interpreted as a UTF-8 character length. To cover the full Unicode plane, we must // `cap` is interpreted as a UTF-8 character length. To cover the full Unicode plane, we must