aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/UlbotechProtocolDecoder.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/UlbotechProtocolDecoder.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/UlbotechProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/UlbotechProtocolDecoder.java12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/org/traccar/protocol/UlbotechProtocolDecoder.java b/src/org/traccar/protocol/UlbotechProtocolDecoder.java
index 0c3ea6391..ed4695a44 100644
--- a/src/org/traccar/protocol/UlbotechProtocolDecoder.java
+++ b/src/org/traccar/protocol/UlbotechProtocolDecoder.java
@@ -67,7 +67,7 @@ public class UlbotechProtocolDecoder extends BaseProtocolDecoder {
while (buf.readerIndex() < end) {
int parameterLength = buf.getUnsignedByte(buf.readerIndex()) >> 4;
int mode = buf.readUnsignedByte() & 0x0F;
- position.add(ObdDecoder.decode(mode, ByteBufUtil.hexDump(buf.readBytes(parameterLength - 1))));
+ position.add(ObdDecoder.decode(mode, ByteBufUtil.hexDump(buf.readSlice(parameterLength - 1))));
}
}
@@ -83,7 +83,7 @@ public class UlbotechProtocolDecoder extends BaseProtocolDecoder {
if (type == 3) {
id += 256;
}
- String value = ByteBufUtil.hexDump(buf.readBytes(len - 1));
+ String value = ByteBufUtil.hexDump(buf.readSlice(len - 1));
if (type == 2 || type == 3) {
position.set("pid" + id, value);
}
@@ -206,7 +206,7 @@ public class UlbotechProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedByte(); // version
buf.readUnsignedByte(); // type
- String imei = ByteBufUtil.hexDump(buf.readBytes(8)).substring(1);
+ String imei = ByteBufUtil.hexDump(buf.readSlice(8)).substring(1);
DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, imei);
if (deviceSession == null) {
@@ -296,7 +296,7 @@ public class UlbotechProtocolDecoder extends BaseProtocolDecoder {
break;
case DATA_CANBUS:
- position.set("can", ByteBufUtil.hexDump(buf.readBytes(length)));
+ position.set("can", ByteBufUtil.hexDump(buf.readSlice(length)));
break;
case DATA_J1708:
@@ -304,12 +304,12 @@ public class UlbotechProtocolDecoder extends BaseProtocolDecoder {
break;
case DATA_VIN:
- position.set(Position.KEY_VIN, buf.readBytes(length).toString(StandardCharsets.US_ASCII));
+ position.set(Position.KEY_VIN, buf.readSlice(length).toString(StandardCharsets.US_ASCII));
break;
case DATA_RFID:
position.set(Position.KEY_DRIVER_UNIQUE_ID,
- buf.readBytes(length - 1).toString(StandardCharsets.US_ASCII));
+ buf.readSlice(length - 1).toString(StandardCharsets.US_ASCII));
position.set("authorized", buf.readUnsignedByte() != 0);
break;