Kal*_*lue 7 java encoding decoding netty
有没有办法将netty ByteBuf转换为String,反之亦然?
public String toString(ByteBuf b){
//return b enconded to a String
}
public Bytebuf ToByteBuff(String s){
//return s decoded to Bytebuf
}
Run Code Online (Sandbox Code Playgroud)
Chr*_*ole 14
您可以使用ByteBuf.toString(Charset)转换为字符串.
您可以使用String.getBytes(Charset)和Unpooled.wrappedBuffer(byte[])转换为ByteBuf.
| 归档时间: |
|
| 查看次数: |
5615 次 |
| 最近记录: |