private void doneEscapeSequenceCharacter(char last) {
    boolean alt = false;
    boolean ctrl = false;
    boolean shift = false;
    if (param2 != 0) {
      alt = isAlt(param2);
      ctrl = isCtrl(param2);
      shift = isShift(param2);
    }

    if (last != '~') {
      switch (last) {
        case 'A':
          offer(new KeyPress(KeyPress.Type.ArrowUp, null, alt, ctrl, shift));
          break;

        case 'B':
          offer(new KeyPress(KeyPress.Type.ArrowDown, null, alt, ctrl, shift));
          break;

        case 'C':
          offer(new KeyPress(KeyPress.Type.ArrowRight, null, alt, ctrl, shift));
          break;

        case 'D':
          offer(new KeyPress(KeyPress.Type.ArrowLeft, null, alt, ctrl, shift));
          break;

        case 'H':
          offer(new KeyPress(KeyPress.Type.Home, null, alt, ctrl, shift));
          break;

        case 'F':
          offer(new KeyPress(KeyPress.Type.End, null, alt, ctrl, shift));
          break;

        case 'P':
          offer(new KeyPress(KeyPress.Type.F1, null, alt, ctrl, shift));
          break;

        case 'Q':
          offer(new KeyPress(KeyPress.Type.F2, null, alt, ctrl, shift));
          break;

        case 'R':
          offer(new KeyPress(KeyPress.Type.F3, null, alt, ctrl, shift));
          break;

        case 'S':
          offer(new KeyPress(KeyPress.Type.F4, null, alt, ctrl, shift));
          break;

        case 'Z':
          offer(new KeyPress(KeyPress.Type.ReverseTab, null, alt, ctrl, shift));
          break;

        default:
          offer(new KeyPress(KeyPress.Type.Unknown, null, alt, ctrl, shift));
          break;
      }
      initState();
      return;
    }

    switch (param1) {
      case 1:
        offer(new KeyPress(KeyPress.Type.Home, null, alt, ctrl, shift));
        break;

      case 2:
        offer(new KeyPress(KeyPress.Type.Insert, null, alt, ctrl, shift));
        break;

      case 3:
        offer(new KeyPress(KeyPress.Type.Delete, null, alt, ctrl, shift));
        break;

      case 4:
        offer(new KeyPress(KeyPress.Type.End, null, alt, ctrl, shift));
        break;

      case 5:
        offer(new KeyPress(KeyPress.Type.PageUp, null, alt, ctrl, shift));
        break;

      case 6:
        offer(new KeyPress(KeyPress.Type.PageDown, null, alt, ctrl, shift));
        break;

      case 11:
        offer(new KeyPress(KeyPress.Type.F1, null, alt, ctrl, shift));
        break;

      case 12:
        offer(new KeyPress(KeyPress.Type.F2, null, alt, ctrl, shift));
        break;

      case 13:
        offer(new KeyPress(KeyPress.Type.F3, null, alt, ctrl, shift));
        break;

      case 14:
        offer(new KeyPress(KeyPress.Type.F4, null, alt, ctrl, shift));
        break;

      case 15:
        offer(new KeyPress(KeyPress.Type.F5, null, alt, ctrl, shift));
        break;

      case 17:
        offer(new KeyPress(KeyPress.Type.F6, null, alt, ctrl, shift));
        break;

      case 18:
        offer(new KeyPress(KeyPress.Type.F7, null, alt, ctrl, shift));
        break;

      case 19:
        offer(new KeyPress(KeyPress.Type.F8, null, alt, ctrl, shift));
        break;

      case 20:
        offer(new KeyPress(KeyPress.Type.F9, null, alt, ctrl, shift));
        break;

      case 21:
        offer(new KeyPress(KeyPress.Type.F10, null, alt, ctrl, shift));
        break;

      case 23:
        offer(new KeyPress(KeyPress.Type.F11, null, alt, ctrl, shift));
        break;

      case 24:
        offer(new KeyPress(KeyPress.Type.F12, null, alt, ctrl, shift));
        break;

      default:
        offer(new KeyPress(KeyPress.Type.Unknown, null, false, false, false));
        break;
    }

    initState();
  }
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