private void escapeSequenceCharacter(char ch) {
    switch (parseState) {
      case ESCAPE_SEQUENCE_PARAM1:
        if (ch == ';') {
          parseState = ParseState.ESCAPE_SEQUENCE_PARAM2;
        } else if (Character.isDigit(ch)) {
          param1 = param1 * 10 + Character.digit(ch, 10);
        } else {
          doneEscapeSequenceCharacter(ch);
        }
        break;

      case ESCAPE_SEQUENCE_PARAM2:
        if (Character.isDigit(ch)) {
          param2 = param2 * 10 + Character.digit(ch, 10);
        } else {
          doneEscapeSequenceCharacter(ch);
        }
        break;

      default:
        throw new AssertionError();
    }
  }
This generates {@link KeyPress} objects from the given input stream and offers them to the given
queue.
hbase-hbtop/src/main/java/org/apache/hadoop/hbase/hbtop/terminal/impl/KeyPressGenerator.java