aboutsummaryrefslogtreecommitdiff
path: root/src/org
diff options
context:
space:
mode:
Diffstat (limited to 'src/org')
-rw-r--r--src/org/traccar/protocol/MeitrackProtocolDecoder.java9
-rw-r--r--src/org/traccar/protocol/Mta6ProtocolDecoder.java2
2 files changed, 5 insertions, 6 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")) {
diff --git a/src/org/traccar/protocol/Mta6ProtocolDecoder.java b/src/org/traccar/protocol/Mta6ProtocolDecoder.java
index b65a16103..c5af48abc 100644
--- a/src/org/traccar/protocol/Mta6ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Mta6ProtocolDecoder.java
@@ -292,7 +292,7 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder {
// Read identifier
buf.skipBytes("id=".length());
- int index = ChannelBufferTools.find(buf, buf.readerIndex(), length, "&");
+ int index = buf.indexOf(buf.readerIndex(), buf.writerIndex(), (byte) '&');
String uniqueId = buf.toString(buf.readerIndex(), index - buf.readerIndex(), Charset.defaultCharset());
if (!identify(uniqueId, channel)) {
return null;