diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-26 12:11:58 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-26 12:11:58 +1300 |
commit | efa23587b3ca8ea0c08e418a4c445cfa0062f110 (patch) | |
tree | 28f27abda4574ee07c1db4ef7449218a78de5497 /src/org/traccar/protocol/MeitrackFrameDecoder.java | |
parent | 39650cf5e3fa32f767dac5ce0ee066e8e4906945 (diff) | |
download | trackermap-server-efa23587b3ca8ea0c08e418a4c445cfa0062f110.tar.gz trackermap-server-efa23587b3ca8ea0c08e418a4c445cfa0062f110.tar.bz2 trackermap-server-efa23587b3ca8ea0c08e418a4c445cfa0062f110.zip |
Modify Meitrack frame decoder
Diffstat (limited to 'src/org/traccar/protocol/MeitrackFrameDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/MeitrackFrameDecoder.java | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/org/traccar/protocol/MeitrackFrameDecoder.java b/src/org/traccar/protocol/MeitrackFrameDecoder.java index e96359104..e34116fa4 100644 --- a/src/org/traccar/protocol/MeitrackFrameDecoder.java +++ b/src/org/traccar/protocol/MeitrackFrameDecoder.java @@ -26,16 +26,14 @@ public class MeitrackFrameDecoder extends FrameDecoder { @Override protected Object decode( - ChannelHandlerContext ctx, - Channel channel, - ChannelBuffer buf) throws Exception { + ChannelHandlerContext ctx, Channel channel, ChannelBuffer buf) throws Exception { if (buf.readableBytes() < 10) { return null; } - Integer index = ChannelBufferTools.find(buf, buf.readerIndex(), buf.writerIndex(), ","); - if (index != null) { + int index = buf.indexOf(buf.readerIndex(), buf.writerIndex(), (byte) ','); + if (index != -1) { int length = index - buf.readerIndex() + Integer.parseInt( buf.toString(buf.readerIndex() + 3, index - buf.readerIndex() - 3, Charset.defaultCharset())); if (buf.readableBytes() >= length) { |