private void flushRow(int row, StringBuilder sb, Attributes lastAttributes) {
    int lastColumn = -1;
    for (int column = 0; column < columns; column++) {
      Cell cell = buffer[column][row];
      Cell pCell = physical[column][row];

      if (!cell.equals(pCell)) {
        if (lastColumn != column - 1 || lastColumn == -1) {
          sb.append(moveCursor(column, row));
        }

        if (cell.isEndOfLine()) {
          for (int i = column; i < columns; i++) {
            physical[i][row].set(buffer[i][row]);
          }

          sb.append(clearRemainingLine());
          lastAttributes.reset();
          return;
        }

        if (!cell.getAttributes().equals(lastAttributes)) {
          sb.append(color(cell.getForegroundColor(), cell.getBackgroundColor(), cell.isBold(),
            cell.isReverse(), cell.isBlink(), cell.isUnderline()));
        }

        sb.append(cell.getChar());

        lastColumn = column;
        lastAttributes.set(cell.getAttributes());

        physical[column][row].set(cell);
      }
    }
  }
Represents a buffer of the terminal screen for double-buffering.
hbase-hbtop/src/main/java/org/apache/hadoop/hbase/hbtop/terminal/impl/ScreenBuffer.java