Class HexDump


  • public class HexDump
    extends java.lang.Object
    Utility for dumping binary data.
    • Constructor Summary

      Constructors 
      Constructor Description
      HexDump()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void hexDump​(java.lang.String name, byte[] bs)
      Output a buffer in hex format.
      static void hexDump​(java.lang.String name, byte[] bs, int len)
      Output a buffer in hex format.
      static void hexDump​(java.lang.String name, byte[] bs, int start, int len)
      Output a buffer in hex format.
      static void hexDump​(java.lang.String prologue, java.lang.String name, byte[] bs, int start, int len)
      Output a buffer in hex format.
      static char toAscii​(byte b)
      Get ASCII representation of byte, dot if non-readable.
      static java.lang.String toHex​(byte b)
      Get hex representation of byte.
      • 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

      • hexDump

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

        public static void hexDump​(java.lang.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​(java.lang.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​(java.lang.String prologue,
                                   java.lang.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 java.lang.String toHex​(byte b)
        Get hex representation of byte.
        Parameters:
        b - the byte to convert.
        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 - the byte to convert.
        Returns:
        ASCII representation of byte, dot if non-readable.