com.mindbright.util
public class HexDump extends java.lang.Object
Constructor and Description |
---|
HexDump() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
formatHex(int i,
int sz)
Format an integer to a hex string with a minimum length
|
static java.lang.String |
intToString(int n)
Returns a string of 8 hexadecimal digits (most significant
digit first) corresponding to the given integer
|
static void |
print(java.math.BigInteger bi)
Print an hex-dump of the given big integer to System.err
|
static void |
print(byte[] buf)
Dump the given array to System.err
|
static void |
print(byte[] buf,
boolean asjavaarr) |
static void |
print(byte[] buf,
int off,
int len)
Print a nice looking hex-dump of the given data on System.err
|
static void |
print(java.io.OutputStream out,
byte[] buf,
int off,
int len)
Print a nice looking hex-dump of the given data to the given stream.
|
static void |
print(java.io.OutputStream out,
java.lang.String header,
boolean showAddr,
boolean javaarr,
byte[] buf,
int off,
int len) |
static void |
print(java.io.OutputStream out,
java.lang.String header,
boolean showAddr,
byte[] buf,
int off,
int len)
Generate and print a nice looking hex-dump of the given data.
|
static void |
print(java.lang.String header,
boolean showAddr,
byte[] buf,
int off,
int len)
Print a nice looking hex-dump of the given data on System.err
|
static java.lang.String |
toAsciiString(byte[] ba) |
static byte[] |
toByteArray(java.lang.String s) |
static java.lang.String |
toString(byte[] ba)
Returns a string of hexadecimal digits from a byte array.
|
static java.lang.String |
toString(byte[] ba,
int offset,
int length)
Returns a string of hexadecimal digits from a byte array.
|
public static java.lang.String intToString(int n)
n
- an unsigned integerpublic static java.lang.String toString(byte[] ba)
ba
- array to convertpublic static java.lang.String toString(byte[] ba, int offset, int length)
ba
- array containing data to convertoffset
- offset of first byte to convertlength
- number of bytes to convertpublic static java.lang.String toAsciiString(byte[] ba)
public static byte[] toByteArray(java.lang.String s)
public static java.lang.String formatHex(int i, int sz)
i
- integer to convertsz
- minimum number of digits in output.public static void print(byte[] buf, boolean asjavaarr)
public static void print(byte[] buf, int off, int len)
buf
- array containing data to dumpoff
- offset of fist byte to dumplen
- number of bytes to dumppublic static void print(java.io.OutputStream out, byte[] buf, int off, int len)
out
- stream to output the hex-dump onbuf
- array containing data to dumpoff
- offset of fist byte to dumplen
- number of bytes to dumppublic static void print(java.lang.String header, boolean showAddr, byte[] buf, int off, int len)
header
- header to print before the actual dumpshowAddr
- if true the offset from the start is shown
first on every line.buf
- array containing data to dumpoff
- offset of fist byte to dumplen
- number of bytes to dumppublic static void print(java.io.OutputStream out, java.lang.String header, boolean showAddr, byte[] buf, int off, int len)
out
- stream to output the hex-dump onheader
- header to print before the actual dumpshowAddr
- if true the offset from the start is shown
first on every line.buf
- array containing data to dumpoff
- offset of fist byte to dumplen
- number of bytes to dumppublic static void print(java.io.OutputStream out, java.lang.String header, boolean showAddr, boolean javaarr, byte[] buf, int off, int len)
public static void print(byte[] buf)
buf
- array to dump, may be null.public static void print(java.math.BigInteger bi)