fr.imag.adele.util.text
Class HexString
java.lang.Object
fr.imag.adele.util.text.HexString
- public class HexString
- extends Object
Method Summary |
static String |
hexify(byte[] data,
int offset,
int length,
int linesize)
Hexify (ie represents in hexadecimal) a byte array |
static String |
hexify(byte[] data,
int offset,
int length,
int linesize,
String separator)
|
static byte |
parseHexChar(char c)
Parse a radix 16 symbol |
static byte[] |
parseHexString(String hexString)
Parse a Hex string |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
hexChars
protected static final String[] hexChars
HexString
public HexString()
parseHexString
public static byte[] parseHexString(String hexString)
throws NumberFormatException
- Parse a Hex string
- Parameters:
hexString
- a sequence of 2-symbol hexadecimal numbers
- Returns:
- a byte array
- Throws:
NumberFormatException
- if a number is not a hexadecimal number
parseHexChar
public static byte parseHexChar(char c)
throws NumberFormatException
- Parse a radix 16 symbol
- Parameters:
c
- a symbol
- Returns:
- a byte
- Throws:
NumberFormatException
- if c is not a hexadecimal symbol
hexify
public static String hexify(byte[] data,
int offset,
int length,
int linesize)
- Hexify (ie represents in hexadecimal) a byte array
- Parameters:
data
- the byte array to hexifyoffset
- the offset in the byte arraylength
- the number of bytes to representlinesize
- the number of byte per line in the string
- Returns:
- a String with Hexadecimal representation of bytes
hexify
public static String hexify(byte[] data,
int offset,
int length,
int linesize,
String separator)