private void drawStatusBar(int rowsInBuffer) {
    terminal.puts(InfoCmp.Capability.save_cursor);
    terminal.puts(InfoCmp.Capability.cursor_address, height - 1, 0);
    AttributedStyle statusBarStyle = AttributedStyle.DEFAULT.background(AttributedStyle.WHITE)
            .foreground(AttributedStyle.BLACK);
    AttributedStringBuilder attrBuilder = new AttributedStringBuilder()
            .style(statusBarStyle.bold().italic())
            .append("Q")
            .style(statusBarStyle)
            .append(": Quit     ")
            .style(statusBarStyle.bold().italic())
            .append("SPACE")
            .style(statusBarStyle)
            .append(": Pause/Resume     ")
            .append(String.valueOf(rowsInBuffer) + " rows in buffer     ");
    if (paused) {
      attrBuilder.style(statusBarStyle.bold().foreground(AttributedStyle.RED).blink())
              .append("PAUSED");
    }
    String statusBarText = attrBuilder.toAnsi();
    terminal.writer().print(statusBarText);
    terminal.flush();
    terminal.puts(InfoCmp.Capability.restore_cursor);
  }
A scrolling (logging) view of the query result of a streaming SELECT statement.
samza-sql-shell/src/main/java/org/apache/samza/sql/client/cli/QueryResultLogView.java