code: public static int getAlphaNumCount(final Buffer buffer) throws IndexOutOfBoundsException, IOException {
          boolean done = false;
          int count = 0;
          final int index = buffer.getReaderIndex();
          while (buffer.hasReadableBytes() && !done) {
              final byte b = buffer.readByte();
              if (isAlphaNum(b)) {
                  ++count;
              } else {
                  done = true;
              }
          }
          buffer.setReaderIndex(index);
          return count;
      }
docs: Helper method that counts the number of bytes that are considered part of
  the next alphanum block.
  
  @param buffer
  @return a count of the number of bytes the next alphaum contains or zero
  if none is found.
  @throws IndexOutOfBoundsException
  @throws IOException