diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-04-27 11:21:27 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2016-04-27 11:21:27 +1200 |
commit | 44f026f881efa6207ab79fb5bada20ab67f018a0 (patch) | |
tree | 62cab9dc7d35c12bf75217eecf85b335ecebbe5a /src/org/traccar/helper | |
parent | aa0cbaa6e849d01a5bb02e2e999b80c178270014 (diff) | |
download | traccar-server-44f026f881efa6207ab79fb5bada20ab67f018a0.tar.gz traccar-server-44f026f881efa6207ab79fb5bada20ab67f018a0.tar.bz2 traccar-server-44f026f881efa6207ab79fb5bada20ab67f018a0.zip |
Rename ChannelBufferTools to BcdUtil
Diffstat (limited to 'src/org/traccar/helper')
-rw-r--r-- | src/org/traccar/helper/BcdUtil.java (renamed from src/org/traccar/helper/ChannelBufferTools.java) | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/src/org/traccar/helper/ChannelBufferTools.java b/src/org/traccar/helper/BcdUtil.java index ad2369bed..a248daf22 100644 --- a/src/org/traccar/helper/ChannelBufferTools.java +++ b/src/org/traccar/helper/BcdUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2012 Anton Tananaev (anton.tananaev@gmail.com) + * Copyright 2012 - 2016 Anton Tananaev (anton.tananaev@gmail.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,19 +17,15 @@ package org.traccar.helper; import org.jboss.netty.buffer.ChannelBuffer; -public final class ChannelBufferTools { +public final class BcdUtil { - private ChannelBufferTools() { + private BcdUtil() { } - /** - * Convert hex to integer (length in hex digits) - */ - public static int readHexInteger(ChannelBuffer buf, int length) { - + public static int readInteger(ChannelBuffer buf, int digits) { int result = 0; - for (int i = 0; i < length / 2; i++) { + for (int i = 0; i < digits / 2; i++) { int b = buf.readUnsignedByte(); result *= 10; result += b >>> 4; @@ -37,7 +33,7 @@ public final class ChannelBufferTools { result += b & 0x0f; } - if (length % 2 != 0) { + if (digits % 2 != 0) { int b = buf.getUnsignedByte(buf.readerIndex()); result *= 10; result += b >>> 4; @@ -46,9 +42,6 @@ public final class ChannelBufferTools { return result; } - /** - * Read BCD coded coordinate (first byte has sign bit) - */ public static double readCoordinate(ChannelBuffer buf) { int b1 = buf.readUnsignedByte(); int b2 = buf.readUnsignedByte(); |