mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-06-09 16:15:21 +00:00
perf[buffer]: string读取用三目运算符优化
This commit is contained in:
@@ -356,10 +356,7 @@ public abstract class ByteBufUtils {
|
||||
|
||||
public static String readString(ByteBuf byteBuf) {
|
||||
int length = readInt(byteBuf);
|
||||
if (length <= 0) {
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
return (String) byteBuf.readCharSequence(length, StringUtils.DEFAULT_CHARSET);
|
||||
return length <= 0 ? StringUtils.EMPTY : (String) byteBuf.readCharSequence(length, StringUtils.DEFAULT_CHARSET);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user