public class HexDump extends Object
Modifier and Type | Field and Description |
---|---|
private static char[] |
_hexcodes |
private static int[] |
_shifts |
static String |
EOL |
Modifier | Constructor and Description |
---|---|
private |
HexDump() |
Modifier and Type | Method and Description |
---|---|
private static String |
dump(byte value) |
static String |
dump(byte[] data,
long offset,
int index)
dump an array of bytes to a String
|
static void |
dump(byte[] data,
long offset,
OutputStream stream,
int index)
dump an array of bytes to an OutputStream
|
static void |
dump(byte[] data,
long offset,
OutputStream stream,
int index,
int length)
dump an array of bytes to an OutputStream
|
static void |
dump(InputStream in,
PrintStream out,
int start,
int bytesToDump)
Dumps
bytesToDump bytes to an output stream. |
private static String |
dump(long value) |
static void |
main(String[] args) |
static String |
toHex(byte value)
Converts the parameter to a hex value.
|
static String |
toHex(byte[] value)
Converts the parameter to a hex value.
|
static String |
toHex(byte[] value,
int bytesPerLine)
Converts the parameter to a hex value breaking the results into
lines.
|
static String |
toHex(int value)
Converts the parameter to a hex value.
|
static String |
toHex(long value)
Converts the parameter to a hex value.
|
private static String |
toHex(long value,
int digits) |
static String |
toHex(short value)
Converts the parameter to a hex value.
|
static String |
toHex(short[] value)
Converts the parameter to a hex value.
|
public static final String EOL
private static final char[] _hexcodes
private static final int[] _shifts
public static void dump(byte[] data, long offset, OutputStream stream, int index, int length) throws IOException, ArrayIndexOutOfBoundsException, IllegalArgumentException
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 arraylength
- number of characters to outputIOException
- 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
nullpublic static void dump(byte[] data, long offset, OutputStream stream, int index) throws IOException, ArrayIndexOutOfBoundsException, IllegalArgumentException
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 arrayIOException
- 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
nullpublic static String dump(byte[] data, long offset, int index)
data
- the byte array to be dumpedoffset
- its offset, whatever that might meanindex
- initial index into the byte arrayArrayIndexOutOfBoundsException
- if the index is
outside the data array's boundsprivate static String dump(long value)
private static String dump(byte value)
public static String toHex(byte[] value)
value
- The value to convertpublic static String toHex(short[] value)
value
- The value to convertpublic static String toHex(byte[] value, int bytesPerLine)
Converts the parameter to a hex value breaking the results into lines.
value
- The value to convertbytesPerLine
- The maximum number of bytes per line. The next byte
will be written to a new linepublic static String toHex(short value)
value
- The value to convertpublic static String toHex(byte value)
value
- The value to convertpublic static String toHex(int value)
value
- The value to convertpublic static String toHex(long value)
value
- The value to convertprivate static String toHex(long value, int digits)
public static void dump(InputStream in, PrintStream out, int start, int bytesToDump) throws IOException
bytesToDump
bytes to an output stream.in
- The stream to read fromout
- The output streamstart
- The index to use as the starting position for the left hand side labelbytesToDump
- The number of bytes to output. Use -1 to read until the end of file.IOException
Copyright © 2015 Open Microscopy Environment