Java 如何将netty ByteBuf转换为字符串,反之亦然

Java 如何将netty ByteBuf转换为字符串,反之亦然,java,encoding,netty,decoding,Java,Encoding,Netty,Decoding,有没有办法将netty ByteBuf转换为字符串,反之亦然 public String toString(ByteBuf b){ //return b enconded to a String } public Bytebuf ToByteBuff(String s){ //return s decoded to Bytebuf } 可以使用转换为字符串 您可以使用和转换为ByteBuf 您可以使用unmooled.copiedBuffer(字符串,字符集)从字符串创建ByteB

有没有办法将netty ByteBuf转换为字符串,反之亦然

public String toString(ByteBuf b){

 //return b enconded to a String
}

public Bytebuf ToByteBuff(String s){

  //return s decoded to Bytebuf
}
可以使用转换为字符串


您可以使用和转换为ByteBuf

您可以使用
unmooled.copiedBuffer(字符串,字符集)
从字符串创建
ByteBuf

这非常有用,尽管它非常简单,哈哈。非常感谢!