code: protected int process(char[] chars, int charIndex, StringBuilder buffer) {
  
      char c = chars[charIndex];
      if (c == '*') {
        buffer.append(".*");
      } else if (c == '?') {
        buffer.append('.');
      } else {
        for (char esc : CHARS_TO_ESCAPE) {
          if (c == esc) {
            // escape
            buffer.append('\\');
            break;
          }
        }
        buffer.append(c);
      }
      return charIndex + 1;
    }
docs: This method processes one or many characters from {@code chars} starting at the given {@code charIndex} and adds
  the translated regexp-sequence to {@code buffer}.
  
  @param chars are the characters of the original pattern string.
  @param charIndex is the current index in {@code chars}.
  @param buffer is where the translated regexp-pattern is appended to.
  @return the index of the next character that has NOT yet been consumed (typically {@code charIndex + 1}).