code: public static String getHexdump(IoBuffer in, int lengthLimit) {
          if (lengthLimit == 0) {
              throw new IllegalArgumentException("lengthLimit: " + lengthLimit + " (expected: 1+)");
          }
  
          boolean truncate = in.remaining() > lengthLimit;
          int size;
          if (truncate) {
              size = lengthLimit;
          }
          else {
              size = in.remaining();
          }
  
          if (size == 0) {
              return "empty";
          }
  
          StringBuilder out = new StringBuilder(in.remaining() * 3 - 1);
  
          int mark = in.position();
  
          // fill the first
          int byteValue = in.get() & 0xFF;
          out.append((char) highDigits[byteValue]);
          out.append((char) lowDigits[byteValue]);
          size--;
  
          // and the others, too
          for (; size > 0; size--) {
              out.append(' ');
              byteValue = in.get() & 0xFF;
              out.append((char) highDigits[byteValue]);
              out.append((char) lowDigits[byteValue]);
          }
  
          in.position(mark);
  
          if (truncate) {
              out.append("...");
          }
  
          return out.toString();
      }
docs: Dumps an {@link IoBuffer} to a hex formatted string.
  
  @param in
  the buffer to dump
  @param lengthLimit
  the limit at which hex dumping will stop
  @return a hex formatted string representation of the <i>in</i>
  {@link Iobuffer}.