本文介绍了将无符号类型写入Netty ChannelBuffer的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Netty的ChannelBuffer类提供了方便的方法来从ChannelBuffer读取未签名的类型,但是似乎没有等效的方法可以将未签名的类型写入ChannelBuffer.
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.
我觉得我一定很想念东西.建议使用什么方法将无符号整数写入ChannelBuffer?
I feel like I must be missing something. What's the recommended approach for say, writing an unsigned integer to a ChannelBuffer?
谢谢!
推荐答案
如果要写入32位值,则完全一样.
If you want to write a 32-bit value its all the same.
channelBuffer.writeInt(my32bitValue);
这篇关于将无符号类型写入Netty ChannelBuffer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!