refactor: 优化tcp报文打印

This commit is contained in:
zhouhao 2025-09-27 17:03:14 +08:00
parent 472e1dc89c
commit d99dac0041
1 changed files with 3 additions and 8 deletions

View File

@ -44,14 +44,9 @@ public class TcpMessage implements EncodedMessage {
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
if (ByteBufUtil.isText(payload, StandardCharsets.UTF_8)) {
builder.append(payloadAsString());
} else {
ByteBufUtil.appendPrettyHexDump(builder, payload);
if (payload == null || !payload.isReadable()) {
return "<released>";
}
return builder.toString();
return ByteBufUtil.prettyHexDump(payload);
}
}