Is there a way to convert a netty ByteBuf to a String and vice versa?
public String toString(ByteBuf b){
//return b enconded to a String
}
public Bytebuf ToByteBuff(String s){
//return s decoded to Bytebuf
}
You can use ByteBuf.toString(Charset)
to convert to string.
You can use String.getBytes(Charset)
and Unpooled.wrappedBuffer(byte[])
to convert to ByteBuf.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With