public class HexDump
extends java.lang.Object
Provides a single function to take an array of bytes and display it in hexadecimal form.
Provenance: POI.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
EOL
Deprecated.
Use
System.lineSeparator() . |
private static char[] |
HEX_CODES |
private static int[] |
SHIFTS |
Constructor and Description |
---|
HexDump()
Instances should NOT be constructed in standard programming.
|
Modifier and Type | Method and Description |
---|---|
static void |
dump(byte[] data,
java.lang.Appendable appendable)
Dumps an array of bytes to an Appendable.
|
static void |
dump(byte[] data,
long offset,
java.lang.Appendable appendable,
int index,
int length)
Dumps an array of bytes to an Appendable.
|
static void |
dump(byte[] data,
long offset,
java.io.OutputStream stream,
int index)
Dumps an array of bytes to an OutputStream.
|
private static java.lang.StringBuilder |
dump(java.lang.StringBuilder _cbuffer,
byte value)
Dumps a byte value into a StringBuilder.
|
private static java.lang.StringBuilder |
dump(java.lang.StringBuilder _lbuffer,
long value)
Dumps a long value into a StringBuilder.
|
@Deprecated public static final java.lang.String EOL
System.lineSeparator()
.private static final char[] HEX_CODES
private static final int[] SHIFTS
public HexDump()
public static void dump(byte[] data, java.lang.Appendable appendable) throws java.io.IOException
data
- the byte array to be dumpedappendable
- the Appendable to which the data is to be writtenjava.io.IOException
- is thrown if anything goes wrong writing
the data to appendablejava.lang.NullPointerException
- if the output appendable is nullpublic static void dump(byte[] data, long offset, java.lang.Appendable appendable, int index, int length) throws java.io.IOException, java.lang.ArrayIndexOutOfBoundsException
The offset argument specifies the start offset of the data array within a larger entity like a file or an incoming stream. For example, if the data array contains the third kibibyte of a file, then the offset argument should be set to 2048. The offset value printed at the beginning of each line indicates where in that larger entity the first byte on that line is located.
data
- the byte array to be dumpedoffset
- offset of the byte array within a larger entityappendable
- the Appendable to which the data is to be writtenindex
- initial index into the byte arraylength
- number of bytes to dump from the arrayjava.io.IOException
- is thrown if anything goes wrong writing
the data to appendablejava.lang.ArrayIndexOutOfBoundsException
- if the index or length is
outside the data array's boundsjava.lang.NullPointerException
- if the output appendable is nullpublic static void dump(byte[] data, long offset, java.io.OutputStream stream, int index) throws java.io.IOException, java.lang.ArrayIndexOutOfBoundsException
The offset argument specifies the start offset of the data array within a larger entity like a file or an incoming stream. For example, if the data array contains the third kibibyte of a file, then the offset argument should be set to 2048. The offset value printed at the beginning of each line indicates where in that larger entity the first byte on that line is located.
All bytes between the given index (inclusive) and the end of the data array are dumped.
data
- the byte array to be dumpedoffset
- offset of the byte array within a larger entitystream
- the OutputStream to which the data is to be
writtenindex
- initial index into the byte arrayjava.io.IOException
- is thrown if anything goes wrong writing
the data to streamjava.lang.ArrayIndexOutOfBoundsException
- if the index is
outside the data array's boundsjava.lang.NullPointerException
- if the output stream is nullprivate static java.lang.StringBuilder dump(java.lang.StringBuilder _cbuffer, byte value)
_cbuffer
- the StringBuilder to dump the value invalue
- the byte value to be dumpedprivate static java.lang.StringBuilder dump(java.lang.StringBuilder _lbuffer, long value)
_lbuffer
- the StringBuilder to dump the value invalue
- the long value to be dumped