从netty ByteBuf获取字符串 [英] Getting string from netty ByteBuf
本文介绍了从netty ByteBuf获取字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何从netty ByteBuf
获取字符串?到目前为止,我能够逐个字符地获取它.有没有办法直接获取字符串对象?
How can I get the string from a netty ByteBuf
? As of now I am able to get it character by character. Is there a way to get the string object directly?
// message is of type ByteBuf
for (int i = 0; i < message.capacity(); i++) {
byte b = message.payload().getByte(i);
System.out.print((char) b);
}
推荐答案
使用提供的方法 查看全文