diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-26 12:38:54 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-26 12:38:54 +1300 |
commit | 0d064e99c1078fe9deb1658d1daa6802ff4685e5 (patch) | |
tree | c822be74eb691a361b7ee33dec79eca024e5e4c1 /src | |
parent | 4acc359d664db81242f6c3a1a7a6dedcf2ab465a (diff) | |
download | trackermap-server-0d064e99c1078fe9deb1658d1daa6802ff4685e5.tar.gz trackermap-server-0d064e99c1078fe9deb1658d1daa6802ff4685e5.tar.bz2 trackermap-server-0d064e99c1078fe9deb1658d1daa6802ff4685e5.zip |
Modify PT502 frame decoder
Diffstat (limited to 'src')
-rw-r--r-- | src/org/traccar/protocol/Pt502FrameDecoder.java | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/org/traccar/protocol/Pt502FrameDecoder.java b/src/org/traccar/protocol/Pt502FrameDecoder.java index 891265c84..8b5b6f791 100644 --- a/src/org/traccar/protocol/Pt502FrameDecoder.java +++ b/src/org/traccar/protocol/Pt502FrameDecoder.java @@ -27,9 +27,7 @@ public class Pt502FrameDecoder 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() < BINARY_HEADER) { return null; @@ -47,8 +45,8 @@ public class Pt502FrameDecoder extends FrameDecoder { } else { - Integer index = ChannelBufferTools.find(buf, 0, buf.readableBytes(), "\n"); - if (index != null) { + int index = buf.indexOf(buf.readerIndex(), buf.writerIndex(), (byte) '\n'); + if (index != -1) { ChannelBuffer result = buf.readBytes(index - 1); buf.skipBytes(2); return result; |