Is there a way to tell Netty 4 that all ByteBuf
instances it creates should have LITTLE_ENDIAN endianness?
Calling order(ByteOrder) in every handler is annoying.
It looks like Netty 3 supported this: Netty and ByteOrder
I wouldn't expect one: big-endian is the ordering of network protocols, so makes sense as the default. And exposing a static variable to set the default would be an invitation for hard-to-diagnose bugs (particularly in a shared server).
I think your best approach is to create a new factory class, to produce the buffers you need. Assuming that you're currently using Unpooled
(per recommendation), it should be a simple search-and replace operation.
You could also update Unpooled
itself, providing variants that take a byte-order param, and submit it back to the project.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.