Class IoBufferHexDumper

java.lang.Object
org.apache.mina.core.buffer.IoBufferHexDumper

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

    • hexDigit

      private static final char[] hexDigit
  • Constructor Details

    • IoBufferHexDumper

      IoBufferHexDumper()
  • Method Details

    • getHexDumpSlice

      public static 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 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 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 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 String toHex(byte b)