java.lang.Object
net.i2p.util.HexDump
Hexdump class (well, it's actually a namespace with some functions, but let's stick with java terminology :-). These methods generate an output that resembles `hexdump -C` (Windows users: do you remember `debug` in the DOS age?).
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intBytes shown on one line.private static final intWidth of the offset column.private static final byte[]Digits used when writing hex.private static final intWidth of one formatted line.Constructor Summary
ConstructorsMethod Summary
All MethodsModifier and TypeMethodDescriptionstatic Stringdump(byte[] data) Dump a byte array in a String.static Stringdump(byte[] data, int off, int len) Dump a byte array in a String.static voiddump(byte[] data, int off, int len, OutputStream out) Dump a byte array through a stream.static voiddump(byte[] data, OutputStream out) Dump a byte array through a stream.
Field Details
FORMAT_OFFSET_PADDING
private static final int FORMAT_OFFSET_PADDINGWidth of the offset column.- See Also:
FORMAT_BYTES_PER_ROW
OUTPUT_BYTES_PER_ROW
private static final int OUTPUT_BYTES_PER_ROWWidth of one formatted line.- See Also:
HEXCHARS
private static final byte[] HEXCHARSDigits used when writing hex.
Constructor Details
HexDump
private HexDump()Utility class.
Method Details
dump
Dump a byte array in a String.- Parameters:
data- Data to be dumped- Returns:
- the hexdump as a String
dump
Dump a byte array in a String.- Parameters:
data- Data to be dumpedoff- Offset from the beginning ofdatalen- Number of bytes ofdatato be dumped- Returns:
- the hexdump as a String
dump
Dump a byte array through a stream.- Parameters:
data- Data to be dumpedout- receives the dump as offset, hex and printable-ASCII columns; not closed or flushed- Throws:
IOException- if the write fails
dump
Dump a byte array through a stream.- Parameters:
data- Data to be dumpedoff- Offset from the beginning ofdatalen- Number of bytes ofdatato be dumpedout- receives the dump; not closed or flushed- Throws:
IOException- if the output stream rejects any of the writes making up the dump