aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-07-01 11:04:03 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-07-01 11:04:03 +1200
commitc099628f0cd07ca6545773a69824b567a6610675 (patch)
tree52319ee2fc4667cf1566f3b4bed21b9780b8b005 /src
parentd6662317306b79717f9d3a1df30fc83cb87866ce (diff)
downloadtrackermap-server-c099628f0cd07ca6545773a69824b567a6610675.tar.gz
trackermap-server-c099628f0cd07ca6545773a69824b567a6610675.tar.bz2
trackermap-server-c099628f0cd07ca6545773a69824b567a6610675.zip
Add byte array conversion method
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/helper/ChannelBufferTools.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/org/traccar/helper/ChannelBufferTools.java b/src/org/traccar/helper/ChannelBufferTools.java
index 09e3d5191..ef9384138 100644
--- a/src/org/traccar/helper/ChannelBufferTools.java
+++ b/src/org/traccar/helper/ChannelBufferTools.java
@@ -15,6 +15,7 @@
*/
package org.traccar.helper;
+import java.math.BigInteger;
import java.util.Formatter;
import org.jboss.netty.buffer.ChannelBuffer;
import org.traccar.protocol.IntellitracFrameDecoder;
@@ -144,4 +145,16 @@ public class ChannelBufferTools {
return out;
}
+ /**
+ * Convert byte array to hex string
+ */
+ public static String convertByteArray(byte[] in) {
+ StringBuilder out = new StringBuilder();
+ Formatter formatter = new Formatter(out);
+ for (byte b : in) {
+ formatter.format("%02x", b);
+ }
+ return out.toString();
+ }
+
}