diff options
Diffstat (limited to 'src/org/traccar/helper/ChannelBufferTools.java')
-rw-r--r-- | src/org/traccar/helper/ChannelBufferTools.java | 14 |
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; + } + } |