Class IoBufferHexDumper


  • class IoBufferHexDumper
    extends java.lang.Object
    Provides utility methods to dump an IoBuffer into a hex formatted string.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static char[] hexDigit  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String getHexDumpSlice​(IoBuffer buf, int offset, int length)
      Dumps an IoBuffer to a hex formatted string.
      static java.lang.String getPrettyHexDumpSlice​(IoBuffer buf, int offset, int length)
      Produces a verbose hex dump
      static java.lang.String toHex​(byte b)  
      static java.lang.String toPrettyHexDump​(byte[] data, int pos, int len)
      Generates a hex dump with line numbers, hex, volumes, and ascii representation
      private static java.lang.String toPrettyHexDumpLine​(byte[] data, int pos, int len, int col, int line)
      Generates the hex dump line with hex values, columns, and ascii representation
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • hexDigit

        private static final char[] hexDigit
    • Constructor Detail

      • IoBufferHexDumper

        IoBufferHexDumper()
    • Method Detail

      • getHexDumpSlice

        public static java.lang.String getHexDumpSlice​(IoBuffer buf,
                                                       int offset,
                                                       int length)
        Dumps an IoBuffer to a hex formatted string.
        Parameters:
        buf - the buffer to dump
        offset - the starting position to begin reading the hex dump
        length - the number of bytes to dump
        Returns:
        a hex formatted string representation of the in IoBuffer.
      • getPrettyHexDumpSlice

        public static final java.lang.String getPrettyHexDumpSlice​(IoBuffer buf,
                                                                   int offset,
                                                                   int length)
        Produces a verbose hex dump
        Parameters:
        offset - initial position which to read bytes
        length - number of bytes to display
        Returns:
        The formatted String representing the content between (offset) and (offset+count)
      • toPrettyHexDump

        public static final java.lang.String toPrettyHexDump​(byte[] data,
                                                             int pos,
                                                             int len)
        Generates a hex dump with line numbers, hex, volumes, and ascii representation
        Parameters:
        data - source data to read for the hex dump
        pos - index position to begin reading
        len - number of bytes to read
        Returns:
        string hex dump
      • toPrettyHexDumpLine

        private static final java.lang.String toPrettyHexDumpLine​(byte[] data,
                                                                  int pos,
                                                                  int len,
                                                                  int col,
                                                                  int line)
        Generates the hex dump line with hex values, columns, and ascii representation
        Parameters:
        data - source data to read for the hex dump
        pos - index position to begin reading
        len - number of bytes to read; this can be less than the line width
        col - number of bytes in a column
        line - line width in bytes which pads the output if len is less than line
        Returns:
        string hex dump
      • toHex

        public static final java.lang.String toHex​(byte b)