org.apache.mina.util

## Class ByteBufferDumper

- java.lang.Object
- - org.apache.mina.util.ByteBufferDumper

    public class ByteBufferDumper
    extends Object

Utility class for smart dumping `ByteBuffer`

Author:
  Apache MINA Project

### Constructor Summary

Constructors
Constructor and Description
`ByteBufferDumper()`

### Method Summary

Methods
`static String` `dump(ByteBuffer buffer)` Dumps the given buffer.
`static String` `dump(ByteBuffer buffer, int nbBytes, boolean toAscii)` Dump the content of the given ByteBuffer, up to a number of bytes.
`static ByteBuffer` `fromHexString(String hex)`
`static String` `toHex(ByteBuffer buffer)` Dump a byte buffer remaining bytes as a hex-decimal string.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### ByteBufferDumper

    public ByteBufferDumper()

### Method Detail

#### dump

    public static String dump(ByteBuffer buffer,
              int nbBytes,
              boolean toAscii)

Dump the content of the given ByteBuffer, up to a number of bytes. If the toAscii flag is set to `true`, this method will try to convert the bytes to a String

Parameters:
  `buffer` - The buffer to dump
  `nbBytes` - The number of bytes to dump (-1 for all of them)
  `toAscii` - If we want to write the message as a String
Returns:
  A dump of this ByteBuffer

#### dump

    public static String dump(ByteBuffer buffer)

Dumps the given buffer. If the buffer contains only ascii, it will write the buffer content as a String.

Parameters:
  `buffer` - The buffer to dump
Returns:
  A string representing the buffer content

#### toHex

    public static String toHex(ByteBuffer buffer)

Dump a byte buffer remaining bytes as a hex-decimal string. The current buffer position will remain unchanged.

Parameters:
  `buffer` - the buffer to dump
Returns:
  a hex string

#### fromHexString

    public static ByteBuffer fromHexString(String hex)