From c40928cd674144fa5ed3dc7306c33b16823b2fad Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 9 Jun 2018 11:53:11 +1200 Subject: Use slices instead of new buffers --- src/org/traccar/protocol/ProgressProtocolDecoder.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/org/traccar/protocol/ProgressProtocolDecoder.java') diff --git a/src/org/traccar/protocol/ProgressProtocolDecoder.java b/src/org/traccar/protocol/ProgressProtocolDecoder.java index c57d6e5ce..dca0e649e 100644 --- a/src/org/traccar/protocol/ProgressProtocolDecoder.java +++ b/src/org/traccar/protocol/ProgressProtocolDecoder.java @@ -79,7 +79,7 @@ public class ProgressProtocolDecoder extends BaseProtocolDecoder { length = buf.readUnsignedShortLE(); buf.skipBytes(length); length = buf.readUnsignedShortLE(); - String imei = buf.readBytes(length).toString(StandardCharsets.US_ASCII); + String imei = buf.readSlice(length).toString(StandardCharsets.US_ASCII); getDeviceSession(channel, remoteAddress, imei); } else if (type == MSG_POINT || type == MSG_ALARM || type == MSG_LOGMSG) { @@ -146,7 +146,7 @@ public class ProgressProtocolDecoder extends BaseProtocolDecoder { } if (BitUtil.check(extraFlags, 2)) { - position.set("passenger", ByteBufUtil.hexDump(buf.readBytes(buf.readUnsignedShortLE()))); + position.set("passenger", ByteBufUtil.hexDump(buf.readSlice(buf.readUnsignedShortLE()))); } if (type == MSG_ALARM) { -- cgit v1.2.3