Package com.metratec.lib.connection
Class DatatypeConverter
- java.lang.Object
-
- com.metratec.lib.connection.DatatypeConverter
-
public class DatatypeConverter extends java.lang.Object
- Author:
- mn
-
-
Constructor Summary
Constructors Constructor Description DatatypeConverter()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
isHexString(java.lang.String string)
static byte[]
parseHexBinary(java.lang.String hexString)
Parse the string and return the represented valuestatic java.lang.String
toHexString(byte[] data)
-
-
-
Method Detail
-
parseHexBinary
public static byte[] parseHexBinary(java.lang.String hexString)
Parse the string and return the represented value- Parameters:
hexString
- the hex string- Returns:
- the byte array which represent the hex string
- Throws:
java.lang.NumberFormatException
- if the hex string have a wrong sign or the length is not straight.
-
toHexString
public static java.lang.String toHexString(byte[] data)
- Parameters:
data
- bytes- Returns:
- hex string
-
isHexString
public static boolean isHexString(java.lang.String string)
- Parameters:
string
- string- Returns:
- true if it is a hex string;
-
-