|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
org.jcoderz.commons.util.HexUtil
public final class HexUtil
This class converts byte array data from and to hex and also provides a hexdump method.
Method Summary | |
---|---|
static |
bytesToHex(byte[] data)
Converts a byte array into an upper-case hex string, starting at the first byte and converting the whole array. |
static |
bytesToHex(byte[] data,
int offset,
int length)
Converts a byte array into an upper-case hex string, starting at the given offset and converting the given number of bytes. |
static |
dump(byte[] data)
Produces a hexdump of the given byte array with a formatting as in "hexdump -C" (canonical hex + ASCII display). |
static byte[] |
stringToBytes( s)
Convert the given hex string to a byte array. |
Methods inherited from class java.lang. |
---|
, , , , , , , , , , |
Method Detail |
---|
public static bytesToHex(byte[] data, int offset, int length) throws
data
- the byte data to convert to hexoffset
- the start offset in the byte arraylength
- the number of bytes to convert
- if offset + length > data.lenghtpublic static bytesToHex(byte[] data)
data
- the byte data to convert to hex
public static byte[] stringToBytes( s) throws
s
- the string to convert
- if the string is not a multiple of 2
characters long, or if the string contains an invalid hex charpublic static dump(byte[] data)
data
- the byte data to dump
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |