Showing
1 changed file
with
1 additions
and
3 deletions
@@ -17,8 +17,6 @@ import io.netty.channel.ChannelHandlerContext; | @@ -17,8 +17,6 @@ import io.netty.channel.ChannelHandlerContext; | ||
17 | import io.netty.channel.ChannelInboundHandlerAdapter; | 17 | import io.netty.channel.ChannelInboundHandlerAdapter; |
18 | import io.netty.util.ReferenceCountUtil; | 18 | import io.netty.util.ReferenceCountUtil; |
19 | import java.net.InetSocketAddress; | 19 | import java.net.InetSocketAddress; |
20 | -import java.nio.ByteBuffer; | ||
21 | -import java.nio.charset.StandardCharsets; | ||
22 | import java.util.*; | 20 | import java.util.*; |
23 | 21 | ||
24 | import io.netty.util.concurrent.Future; | 22 | import io.netty.util.concurrent.Future; |
@@ -81,7 +79,7 @@ public class TcpTransportHandler extends ChannelInboundHandlerAdapter implements | @@ -81,7 +79,7 @@ public class TcpTransportHandler extends ChannelInboundHandlerAdapter implements | ||
81 | if (msg instanceof ByteBuf) { | 79 | if (msg instanceof ByteBuf) { |
82 | ByteBuf message = (ByteBuf) msg; | 80 | ByteBuf message = (ByteBuf) msg; |
83 | byte[] byteMsg = ByteBufUtils.buf2Bytes(message); | 81 | byte[] byteMsg = ByteBufUtils.buf2Bytes(message); |
84 | - String msgStr = StandardCharsets.UTF_8.decode(ByteBuffer.wrap(byteMsg)).toString(); | 82 | + String msgStr = ByteUtils.bytesToStr(byteMsg); |
85 | log.debug( | 83 | log.debug( |
86 | "TCP服务【{}】收到设备【{}】来自【{}】数据【{}】", | 84 | "TCP服务【{}】收到设备【{}】来自【{}】数据【{}】", |
87 | sessionId, | 85 | sessionId, |