code: private static String getDumpBytes(WsByteBuffer buffer, int bytesToDump, boolean rewind)
     {
        // Save the current position
        int pos = buffer.position();
        if (rewind)
        {
           buffer.rewind();
        }
  
        byte[] data = null;
        int start;
        int count = bytesToDump;
        if (count > buffer.remaining() || count == ENTIRE_BUFFER) count = buffer.remaining();
  
        if (buffer.hasArray())
        {
           data = buffer.array();
           start = buffer.arrayOffset() + buffer.position();
        }
        else
        {
           data = new byte[count];
           buffer.get(data);
           start = 0;
        }
  
        String strData = "Dumping "+count+" bytes of buffer data:\r\n";
        if (count > 0) strData += SibTr.formatBytes(data, start, count);
  
        // Return the position to where it should be
        if (rewind) buffer.position(pos);
  
        return strData;
     }
docs: Returns a dump of the specified number of bytes of the specified buffer.
  
  @param buffer
  @param bytesToDump
  
  @return Returns a String containing a dump of the buffer.