Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Netty and ByteOrder

Due to poor documentation and lack of experience with Netty, i faced with little problem. I have no clue how can i set a default ByteOrder.

I need a Little-Endian set by default. I'll be glad, if someone will give me some hints about this.

like image 380
VirtualVoid Avatar asked Mar 18 '12 13:03

VirtualVoid


People also ask

What is ByteBuf in Netty?

A random and sequential accessible sequence of zero or more bytes (octets). This interface provides an abstract view for one or more primitive byte arrays ( byte[] ) and NIO buffers.


1 Answers

You could use Bootstrap.setOption() to do this.

    serverBootstrap.setOption("child.bufferFactory", new
HeapChannelBufferFactory(ByteOrder.LITTLE_ENDIAN));
    ... or ...
    clientBootstrap.setOption("bufferFactory", new
HeapChannelBufferFactory(ByteOrder.LITTLE_ENDIAN));
like image 171
Abe Avatar answered Sep 20 '22 01:09

Abe