code: static String dbgBuffer(ByteBuffer b, int size) {
      StringBuilder sb = new StringBuilder();
      byte[] bytes = b.array();
      for (int i = 0; i < size; i++) {
        char ch = (char) bytes[i];
        if (Character.isWhitespace(ch) || Character.isLetterOrDigit(ch)) {
          sb.append(ch);
        } else {
          sb.append("\\x");
          sb.append(Integer.toHexString(bytes[i] & 0xff));
        }
      }
      return sb.toString();
    }
docs: Convert the {@link ByteBuffer} into a string for easier debugging.
  
  @param b the buffer to debug.
  @param size the size of the buffer.
  @return the stringified {@link ByteBuffer}.