Top Description Fields Constructors Methods
org.apache.commons.io

public Class HexDump

extends Object
Class Inheritance
Imports
java.io.IOException, .OutputStream

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.

Authors
Scott Sanders, Marc Johnson
Version
$Id: HexDump.java 437680 2006-08-28 11:57:00Z scolebourne $

Field Summary

Modifier and TypeField and Description
private static final StringBuffer
private static final char[]
private static final StringBuffer
private static final int[]
public static final String
EOL

The line-separator (initializes to "line.separator" system property.

Constructor Summary

AccessConstructor and Description
public
HexDump()

Instances should NOT be constructed in standard programming.

Method Summary

Modifier and TypeMethod and Description
public static void
dump(byte[]
the byte array to be dumped
data
,
long
its offset, whatever that might mean
offset
,
OutputStream
the OutputStream to which the data is to be written
stream
,
int
initial index into the byte array
index
)

Dump an array of bytes to an OutputStream.

private static StringBuffer

Returns:

StringBuffer containing the dumped value.
dump
(long
the long value to be dumped
value
)

Dump a long value into a StringBuffer.

private static StringBuffer

Returns:

StringBuffer containing the dumped value.
dump
(byte
the byte value to be dumped
value
)

Dump a byte value into a StringBuffer.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_cbufferback to summary
private static final StringBuffer _cbuffer
_hexcodesback to summary
private static final char[] _hexcodes
_lbufferback to summary
private static final StringBuffer _lbuffer
_shiftsback to summary
private static final int[] _shifts
EOLback to summary
public static final String EOL

The line-separator (initializes to "line.separator" system property.

Constructor Detail

HexDumpback to summary
public HexDump()

Instances should NOT be constructed in standard programming.

Method Detail

dumpback to summary
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:byte[]

the byte array to be dumped

offset:long

its offset, whatever that might mean

stream:OutputStream

the OutputStream to which the data is to be written

index:int

initial index into the byte array

Exceptions
IOException:
is thrown if anything goes wrong writing the data to stream
ArrayIndexOutOfBoundsException:
if the index is outside the data array's bounds
IllegalArgumentException:
if the output stream is null
dumpback to summary
private static StringBuffer dump(long value)

Dump a long value into a StringBuffer.

Parameters
value:long

the long value to be dumped

Returns:StringBuffer

StringBuffer containing the dumped value.

dumpback to summary
private static StringBuffer dump(byte value)

Dump a byte value into a StringBuffer.

Parameters
value:byte

the byte value to be dumped

Returns:StringBuffer

StringBuffer containing the dumped value.