- java.lang.Object
-
- de.carne.text.HexBytes
-
public final class HexBytes extends java.lang.ObjectUtility class providing hex sequence conversion functions.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringtoStringL(byte[] bs)Converts a byte array to a lower case hex sequence.static java.lang.StringtoStringL(byte[] bs, int off, int len)Converts a byte array to a lower case hex sequence.static java.lang.StringtoStringU(byte[] bs)Converts a byte array to an upper case hex sequence.static java.lang.StringtoStringU(byte[] bs, int off, int len)Converts a byte array to an upper case hex sequence.static intvalueOf(char c)Converts a hex character to a byte value.static byte[]valueOf(java.lang.String s)Converts a hex sequence to a byte array.
-
-
-
Method Detail
-
toStringL
public static java.lang.String toStringL(byte[] bs)
Converts a byte array to a lower case hex sequence.- Parameters:
bs- the byte array to convert.- Returns:
- the hex sequence representing the byte array.
-
toStringL
public static java.lang.String toStringL(byte[] bs, int off, int len)Converts a byte array to a lower case hex sequence.- Parameters:
bs- the byte array to convert.off- the first byte to convert.len- the number of bytes to convert.- Returns:
- the hex sequence representing the byte array.
-
toStringU
public static java.lang.String toStringU(byte[] bs)
Converts a byte array to an upper case hex sequence.- Parameters:
bs- the byte array to convert.- Returns:
- the hex sequence representing the byte array.
-
toStringU
public static java.lang.String toStringU(byte[] bs, int off, int len)Converts a byte array to an upper case hex sequence.- Parameters:
bs- the byte array to convert.off- the first byte to convert.len- the number of bytes to convert.- Returns:
- the hex sequence representing the byte array.
-
valueOf
public static byte[] valueOf(java.lang.String s)
Converts a hex sequence to a byte array.- Parameters:
s- the hex sequence to convert.- Returns:
- the byte array represented by the submitted hex sequence.
- Throws:
java.lang.NumberFormatException- if the hex sequence is invalid.
-
valueOf
public static int valueOf(char c)
Converts a hex character to a byte value.- Parameters:
c- the hex character to convert.- Returns:
- the byte value represented by the submitted hex character.
- Throws:
java.lang.NumberFormatException- if the hex character is invalid.
-
-