From f47ab14095137689e1c9040ab5add2f6e3174023 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Fri, 26 Jun 2015 11:14:32 +1200 Subject: Change buffer byte order --- src/org/traccar/protocol/MxtFrameDecoder.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/org/traccar/protocol') diff --git a/src/org/traccar/protocol/MxtFrameDecoder.java b/src/org/traccar/protocol/MxtFrameDecoder.java index 82aa5c91a..56a90c765 100644 --- a/src/org/traccar/protocol/MxtFrameDecoder.java +++ b/src/org/traccar/protocol/MxtFrameDecoder.java @@ -21,6 +21,8 @@ import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; import org.jboss.netty.handler.codec.frame.FrameDecoder; +import java.nio.ByteOrder; + public class MxtFrameDecoder extends FrameDecoder { @Override @@ -35,7 +37,7 @@ public class MxtFrameDecoder extends FrameDecoder { int index = buf.indexOf(buf.readerIndex() + 1, buf.writerIndex(), (byte) 0x04); if (index != -1) { - ChannelBuffer result = ChannelBuffers.buffer(index + 1 - buf.readerIndex()); + ChannelBuffer result = ChannelBuffers.buffer(ByteOrder.LITTLE_ENDIAN, index + 1 - buf.readerIndex()); while (buf.readerIndex() <= index) { int b = buf.readUnsignedByte(); @@ -46,6 +48,8 @@ public class MxtFrameDecoder extends FrameDecoder { } } + String s = ChannelBuffers.hexDump(result); + return result; } -- cgit v1.2.3