aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/helper/ChannelBufferTools.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-01-07 16:16:12 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-01-07 16:16:12 +1300
commit68e178c43d8619b8b13aa78828c75e788d4d2621 (patch)
tree178144cd8e08202139f0023000696af051c30156 /src/org/traccar/helper/ChannelBufferTools.java
parent17b247bb7d55be49ef1ca24465e81c350ca7b49c (diff)
downloadtrackermap-server-68e178c43d8619b8b13aa78828c75e788d4d2621.tar.gz
trackermap-server-68e178c43d8619b8b13aa78828c75e788d4d2621.tar.bz2
trackermap-server-68e178c43d8619b8b13aa78828c75e788d4d2621.zip
Add hex conversion method
Diffstat (limited to 'src/org/traccar/helper/ChannelBufferTools.java')
-rw-r--r--src/org/traccar/helper/ChannelBufferTools.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/org/traccar/helper/ChannelBufferTools.java b/src/org/traccar/helper/ChannelBufferTools.java
index ef2ebc313..0de07610d 100644
--- a/src/org/traccar/helper/ChannelBufferTools.java
+++ b/src/org/traccar/helper/ChannelBufferTools.java
@@ -17,6 +17,7 @@ package org.traccar.helper;
import java.util.Formatter;
import org.jboss.netty.buffer.ChannelBuffer;
+import org.traccar.protocol.IntellitracFrameDecoder;
/**
* ChannelBuffer helper methods
@@ -130,4 +131,17 @@ public class ChannelBufferTools {
}
return out;
}
+
+ /**
+ * Convert hex string to byte array
+ */
+ public static byte[] convertHexString(String in) {
+ int count = in.length() / 2;
+ byte[] out = new byte[count];
+ for (int i = 0; i < count; i++) {
+ out[i] = Integer.valueOf(in.substring(i * 2, (i + 1) * 2), 16).byteValue();
+ }
+ return out;
+ }
+
}