首页 > Web开发 > 详细

netty(9)ByteBuf的操作

时间:2018-04-04 15:50:30      阅读:363      评论:0      收藏:0      [点我收藏+]

1.读取ByteBuf之后的转换

在channelRead(ChannelHandlerContext ctx,Object msg)函数中,

a.转换成String

ByteBuf in=(ByteBuf)msg;

String conv=in.toString(CharsetUtil.US_ASCII);

说明:ByteBuf 中toString的作用:

Decodes this buffer‘s readable bytes into a string with the specified
* character set name. US_ASCII,UTF_8等值

 

netty(9)ByteBuf的操作

原文:https://www.cnblogs.com/legion/p/8717466.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!