org.apache.commons.io
Class HexDump
java.lang.Object
|
+--org.apache.commons.io.HexDump
- public class HexDump
- extends Object
Dumps data in hexadecimal format.
Provides a single function to take an array of bytes and display it
in hexadecimal form.
Origin of code: POI.
- Version:
- $Id: HexDump.java 437680 2006-08-28 11:57:00Z scolebourne $
- Author:
- Scott Sanders, Marc Johnson
Constructor Summary |
HexDump()
Instances should NOT be constructed in standard programming. |
Method Summary |
private static StringBuffer |
dump(byte value)
Dump a byte value into a StringBuffer. |
static void |
dump(byte[] data,
long offset,
OutputStream stream,
int index)
Dump an array of bytes to an OutputStream. |
private static StringBuffer |
dump(long value)
Dump a long value into a StringBuffer. |
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
EOL
public static final String EOL
- The line-separator (initializes to "line.separator" system property.
_lbuffer
private static final StringBuffer _lbuffer
_cbuffer
private static final StringBuffer _cbuffer
_hexcodes
private static final char[] _hexcodes
_shifts
private static final int[] _shifts
HexDump
public HexDump()
- Instances should NOT be constructed in standard programming.
dump
public static void dump(byte[] data,
long offset,
OutputStream stream,
int index)
throws IOException,
ArrayIndexOutOfBoundsException,
IllegalArgumentException
- Dump an array of bytes to an OutputStream.
- Parameters:
data
- the byte array to be dumpedoffset
- its offset, whatever that might meanstream
- the OutputStream to which the data is to be
writtenindex
- initial index into the byte array- Throws:
IOException
- is thrown if anything goes wrong writing
the data to streamArrayIndexOutOfBoundsException
- if the index is
outside the data array's boundsIllegalArgumentException
- if the output stream is null
dump
private static StringBuffer dump(long value)
- Dump a long value into a StringBuffer.
- Parameters:
value
- the long value to be dumped- Returns:
- StringBuffer containing the dumped value.
dump
private static StringBuffer dump(byte value)
- Dump a byte value into a StringBuffer.
- Parameters:
value
- the byte value to be dumped- Returns:
- StringBuffer containing the dumped value.