Class HexDump


  • public class HexDump
    extends Object
    Utility for dumping binary data.
    Version:
    $Id$
    Author:
    Matej Sekoranja
    • Constructor Detail

      • HexDump

        public HexDump()
    • Method Detail

      • hexDump

        public static void hexDump​(String name,
                                   byte[] bs)
        Output a buffer in hex format.
        Parameters:
        name - name (desctription) of the message.
        bs - buffer to dump
      • hexDump

        public static void hexDump​(String name,
                                   byte[] bs,
                                   int len)
        Output a buffer in hex format.
        Parameters:
        name - name (description) of the message.
        bs - buffer to dump
        len - first bytes (length) to dump.
      • hexDump

        public static void hexDump​(String name,
                                   byte[] bs,
                                   int start,
                                   int len)
        Output a buffer in hex format.
        Parameters:
        name - name (description) of the message.
        bs - buffer to dump
        start - dump message using given offset.
        len - first bytes (length) to dump.
      • hexDump

        public static void hexDump​(String prologue,
                                   String name,
                                   byte[] bs,
                                   int start,
                                   int len)
        Output a buffer in hex format.
        Parameters:
        prologue - string to prefixed to debug output, can be null
        name - name (description) of the message.
        bs - buffer to dump
        start - dump message using given offset.
        len - first bytes (length) to dump.
      • toHex

        public static final String toHex​(byte b)
        Get hex representation of byte.
        Parameters:
        b - byte to hex.
        Returns:
        string hex representation of byte.
      • toAscii

        public static final char toAscii​(byte b)
        Get ASCII representation of byte, dot if non-readable.
        Parameters:
        b - byte to ASCII.
        Returns:
        ASCII representation of byte, dot if non-readable.