Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.mindbright.util
Class HexDump

    java.lang.Object
      com.mindbright.util.HexDump

public class HexDump
extends java.lang.Object

Utility routines for creating readable dumps of binary data.

Constructor Summary
`HexDump()`

Method Summary
`static java.lang.String` | `formatHex(int i, int sz)` Format an integer to a hex string with a minimum length
`static java.lang.String` | `intToString(int n)` Returns a string of 8 hexadecimal digits (most significant digit first) corresponding to the given integer
`static void` | `print(java.math.BigInteger bi)` Print an hex-dump of the given big integer to System.err
`static void` | `print(byte[] buf)` Dump the given array to System.err
`static void` | `print(byte[] buf, int off, int len)` Print a nice looking hex-dump of the given data on System.err
`static void` | `print(java.io.OutputStream out, byte[] buf, int off, int len)` Print a nice looking hex-dump of the given data to the given stream.
`static void` | `print(java.io.OutputStream out, java.lang.String header, boolean showAddr, byte[] buf, int off, int len)` Generate and print a nice looking hex-dump of the given data.
`static void` | `print(java.lang.String header, boolean showAddr, byte[] buf, int off, int len)` Print a nice looking hex-dump of the given data on System.err
`static java.lang.String` | `toString(byte[] ba)` Returns a string of hexadecimal digits from a byte array.
`static java.lang.String` | `toString(byte[] ba, int offset, int length)` Returns a string of hexadecimal digits from a byte array.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### HexDump

    public HexDump()

Method Detail

### intToString

    public static java.lang.String intToString(int n)

  Returns a string of 8 hexadecimal digits (most significant digit first) corresponding to the given integer

  Parameters:
    `n` - an unsigned integer

### toString

    public static java.lang.String toString(byte[] ba)

  Returns a string of hexadecimal digits from a byte array. Each byte is converted to 2 hex symbols.

  Parameters:
    `ba` - array to convert
  Returns:
    the corresponding hex-number

### toString

    public static java.lang.String toString(byte[] ba,
                                            int offset,
                                            int length)

  Returns a string of hexadecimal digits from a byte array. Each byte is converted to 2 hex symbols.

  Parameters:
    `ba` - array containing data to convert
    `offset` - offset of first byte to convert
    `length` - number of bytes to convert
  Returns:
    the corresponding hex-number

### formatHex

    public static java.lang.String formatHex(int i,
                                             int sz)

  Format an integer to a hex string with a minimum length

  Parameters:
    `i` - integer to convert
    `sz` - minimum number of digits in output.

### print

    public static void print(byte[] buf,
                             int off,
                             int len)

  Print a nice looking hex-dump of the given data on System.err

  Parameters:
    `buf` - array containing data to dump
    `off` - offset of fist byte to dump
    `len` - number of bytes to dump

### print

    public static void print(java.io.OutputStream out,
                             byte[] buf,
                             int off,
                             int len)

  Print a nice looking hex-dump of the given data to the given stream.

  Parameters:
    `out` - stream to output the hex-dump on
    `buf` - array containing data to dump
    `off` - offset of fist byte to dump
    `len` - number of bytes to dump

### print

    public static void print(java.lang.String header,
                             boolean showAddr,
                             byte[] buf,
                             int off,
                             int len)

  Print a nice looking hex-dump of the given data on System.err

  Parameters:
    `header` - header to print before the actual dump
    `showAddr` - if true the offset from the start is shown first on every line.
    `buf` - array containing data to dump
    `off` - offset of fist byte to dump
    `len` - number of bytes to dump

### print

    public static void print(java.io.OutputStream out,
                             java.lang.String header,
                             boolean showAddr,
                             byte[] buf,
                             int off,
                             int len)

  Generate and print a nice looking hex-dump of the given data.

  Parameters:
    `out` - stream to output the hex-dump on
    `header` - header to print before the actual dump
    `showAddr` - if true the offset from the start is shown first on every line.
    `buf` - array containing data to dump
    `off` - offset of fist byte to dump
    `len` - number of bytes to dump

### print

    public static void print(byte[] buf)

  Dump the given array to System.err

  Parameters:
    `buf` - array to dump, may be null.

### print

    public static void print(java.math.BigInteger bi)

  Print an hex-dump of the given big integer to System.err

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD