FrameDecoder and ByteOrder

DenisG2 denis_konev at inbox.ru
Tue May 19 06:32:37 EDT 2009


Hi!
I had a following problem with FrameDecoder:
Data decoding demands ByteOrder.LITTLE_ENDIAN.
I do in SimpleChannelHandler extension:


   public void channelConnected(
            ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception
{

        e.getChannel().getConfig().setOption("bufferFactory", new
HeapChannelBufferFactory(ByteOrder.LITTLE_ENDIAN));
        ...


Here a decoder part:


    protected Object decode(
            ChannelHandlerContext ctx, Channel channel, ChannelBuffer buf)
throws Exception {

        System.out.println("buffer class: " + buf.getClass());
        System.out.println("buffer byte order: " + buf.order());
        ...
        short addr = buf.readShort(); // in little endian
        ...


As a result to me comes LittleEndianHeapChannelBuffer only for the first
time, and all subsequent times comes already DynamicChannelBuffer with
ByteOrder.BIG_ENDIAN

russian bear.

-- 
View this message in context: http://n2.nabble.com/FrameDecoder-and-ByteOrder-tp2938740p2938740.html
Sent from the Netty User Group mailing list archive at Nabble.com.




More information about the netty-users mailing list