From 501853e807a00b15ad9a181dd76a43e4f8cadd1c Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Fri, 29 Jan 2021 17:59:00 -0500 Subject: [PATCH] Fix Checkstyle issue for the umpteenth time... --- .../proxy/protocol/ProtocolUtils.java | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/ProtocolUtils.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/ProtocolUtils.java index e0259b033..7da858d9f 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/ProtocolUtils.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/ProtocolUtils.java @@ -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 * {@code cap} size. This method is specialized for select parts of the Minecraft protocol where @@ -131,6 +115,22 @@ public enum ProtocolUtils { 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) { 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