aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-06-09 11:53:11 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2018-06-09 11:53:11 +1200
commitc40928cd674144fa5ed3dc7306c33b16823b2fad (patch)
tree1180e335ca1ad10c4cb40033c7acf2b62dfbc8d1 /src/org/traccar/protocol/TeltonikaProtocolDecoder.java
parent44cdc3449fccd22b21fec1c9a0febea807cc2489 (diff)
downloadtrackermap-server-c40928cd674144fa5ed3dc7306c33b16823b2fad.tar.gz
trackermap-server-c40928cd674144fa5ed3dc7306c33b16823b2fad.tar.bz2
trackermap-server-c40928cd674144fa5ed3dc7306c33b16823b2fad.zip
Use slices instead of new buffers
Diffstat (limited to 'src/org/traccar/protocol/TeltonikaProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/TeltonikaProtocolDecoder.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
index 34afe28ad..5e9b6640e 100644
--- a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
+++ b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
@@ -79,7 +79,7 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_TYPE, buf.readUnsignedByte());
- position.set(Position.KEY_RESULT, buf.readBytes(buf.readInt()).toString(StandardCharsets.US_ASCII));
+ position.set(Position.KEY_RESULT, buf.readSlice(buf.readInt()).toString(StandardCharsets.US_ASCII));
}
@@ -151,7 +151,7 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
case 134:
String driver = id == 129 || id == 132 ? "" : position.getString("driver1");
position.set("driver" + (id >= 132 ? 2 : 1),
- driver + buf.readBytes(length).toString(StandardCharsets.US_ASCII).trim());
+ driver + buf.readSlice(length).toString(StandardCharsets.US_ASCII).trim());
break;
case 179:
position.set(Position.PREFIX_OUT + 1, readValue(buf, length, false) == 1);
@@ -394,7 +394,7 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
if (extended) {
int cnt = buf.readUnsignedByte();
for (int j = 0; j < cnt; j++) {
- position.set(Position.PREFIX_IO + buf.readUnsignedByte(), ByteBufUtil.hexDump(buf.readBytes(16)));
+ position.set(Position.PREFIX_IO + buf.readUnsignedByte(), ByteBufUtil.hexDump(buf.readSlice(16)));
}
}
@@ -482,7 +482,7 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedShort(); // packet id
buf.readUnsignedByte(); // packet type
int locationPacketId = buf.readUnsignedByte();
- String imei = buf.readBytes(buf.readUnsignedShort()).toString(StandardCharsets.US_ASCII);
+ String imei = buf.readSlice(buf.readUnsignedShort()).toString(StandardCharsets.US_ASCII);
return parseData(channel, remoteAddress, buf, locationPacketId, imei);