aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/MeitrackProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-10-26 12:04:31 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-10-26 12:04:31 +1300
commit39650cf5e3fa32f767dac5ce0ee066e8e4906945 (patch)
treef77cc08023b10698f6a6a6ae1b614a203ba1779b /src/org/traccar/protocol/MeitrackProtocolDecoder.java
parent7ee16ab6fe928171ded0e188811a631743285a58 (diff)
downloadtrackermap-server-39650cf5e3fa32f767dac5ce0ee066e8e4906945.tar.gz
trackermap-server-39650cf5e3fa32f767dac5ce0ee066e8e4906945.tar.bz2
trackermap-server-39650cf5e3fa32f767dac5ce0ee066e8e4906945.zip
Use indexOf method in decoders
Diffstat (limited to 'src/org/traccar/protocol/MeitrackProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/MeitrackProtocolDecoder.java9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/org/traccar/protocol/MeitrackProtocolDecoder.java b/src/org/traccar/protocol/MeitrackProtocolDecoder.java
index 7c5399a37..f8eb6ed91 100644
--- a/src/org/traccar/protocol/MeitrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/MeitrackProtocolDecoder.java
@@ -181,7 +181,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
List<Position> positions = new LinkedList<>();
String flag = buf.toString(2, 1, Charset.defaultCharset());
- int index = ChannelBufferTools.find(buf, 0, buf.readableBytes(), ",");
+ int index = buf.indexOf(buf.readerIndex(), buf.writerIndex(), (byte) ',');
// Identification
String imei = buf.toString(index + 1, 15, Charset.defaultCharset());
@@ -262,14 +262,13 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
@Override
protected Object decode(
- Channel channel, SocketAddress remoteAddress, Object msg)
- throws Exception {
+ Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {
ChannelBuffer buf = (ChannelBuffer) msg;
// Find type
- Integer index = ChannelBufferTools.find(buf, 0, buf.readableBytes(), ",");
- index = ChannelBufferTools.find(buf, index + 1, buf.readableBytes(), ",");
+ Integer index = buf.indexOf(buf.readerIndex(), buf.writerIndex(), (byte) ',');
+ index = buf.indexOf(index + 1, buf.writerIndex(), (byte) ',');
String type = buf.toString(index + 1, 3, Charset.defaultCharset());
if (type.equals("CCC")) {