aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/helper/ChannelBufferTools.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-10-04 13:20:46 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-10-04 13:20:46 +1300
commitd4dbf85d9536bfec85252a58fc552e2bad42ff17 (patch)
tree4a849426c2cd60538b152138b147abef47b40966 /src/org/traccar/helper/ChannelBufferTools.java
parent9218bc65b9673b24d2866aae3d5bbe1a5388bab0 (diff)
downloadtrackermap-server-d4dbf85d9536bfec85252a58fc552e2bad42ff17.tar.gz
trackermap-server-d4dbf85d9536bfec85252a58fc552e2bad42ff17.tar.bz2
trackermap-server-d4dbf85d9536bfec85252a58fc552e2bad42ff17.zip
Remove trailing whitespaces from code
Diffstat (limited to 'src/org/traccar/helper/ChannelBufferTools.java')
-rw-r--r--src/org/traccar/helper/ChannelBufferTools.java26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/org/traccar/helper/ChannelBufferTools.java b/src/org/traccar/helper/ChannelBufferTools.java
index 12e8fc93d..75c16ae50 100644
--- a/src/org/traccar/helper/ChannelBufferTools.java
+++ b/src/org/traccar/helper/ChannelBufferTools.java
@@ -55,14 +55,14 @@ public class ChannelBufferTools {
return null;
}
-
+
/**
* Convert hex to integer (length in hex digits)
*/
public static int readHexInteger(ChannelBuffer buf, int length) {
-
+
int result = 0;
-
+
for (int i = 0; i < length / 2; i++) {
int b = buf.readUnsignedByte();
result *= 10;
@@ -70,13 +70,13 @@ public class ChannelBufferTools {
result *= 10;
result += b & 0x0f;
}
-
+
if (length % 2 == 1) {
int b = buf.getUnsignedByte(buf.readerIndex());
result *= 10;
result += b >>> 4;
}
-
+
return result;
}
@@ -84,22 +84,22 @@ public class ChannelBufferTools {
* Return hex string
*/
public static String readHexString(ChannelBuffer buf, int length) {
-
+
StringBuilder result = new StringBuilder();
Formatter formatter = new Formatter(result);
-
+
for (int i = 0; i < length / 2; i++) {
formatter.format("%02x", buf.readByte());
}
-
+
if (length % 2 == 1) {
int b = buf.getUnsignedByte(buf.readerIndex());
formatter.format("%01x", b >>> 4);
}
-
+
return result.toString();
}
-
+
/**
* Read BCD coded coordinate (first byte has sign bit)
*/
@@ -108,16 +108,16 @@ public class ChannelBufferTools {
int b2 = buf.readUnsignedByte();
int b3 = buf.readUnsignedByte();
int b4 = buf.readUnsignedByte();
-
+
double value = (b2 & 0xf) * 10 + (b3 >> 4);
value += (((b3 & 0xf) * 10 + (b4 >> 4)) * 10 + (b4 & 0xf)) / 1000.0;
value /= 60;
value += ((b1 >> 4 & 0x7) * 10 + (b1 & 0xf)) * 10 + (b2 >> 4);
-
+
if ((b1 & 0x80) != 0) {
value = -value;
}
-
+
return value;
}