Writing unsigned types to a Netty ChannelBuffer

2019-07-04 05:16发布

Netty's ChannelBuffer class provides convenient methods for reading unsigned types from a ChannelBuffer, however there don't appear to be any equivalent methods for writing unsigned types to a ChannelBuffer.

I feel like I must be missing something. What's the recommended approach for say, writing an unsigned integer to a ChannelBuffer?

Thanks!

标签: java netty
2条回答
不美不萌又怎样
2楼-- · 2019-07-04 05:50

If you want to write a 32-bit value its all the same.

channelBuffer.writeInt(my32bitValue);
查看更多
迷人小祖宗
3楼-- · 2019-07-04 05:51

i think this may help you Can we make unsigned byte in Java

you can just send msg like this.

byteBuf.writeByte(0x80);
查看更多
登录 后发表回答