Beispiel #1
0
  /**
   * Construct a remote text screen for the given terminal.
   *
   * @param terminalIO
   */
  public RemoteTextScreen(TerminalIO terminalIO) {
    super(terminalIO.getColumns(), terminalIO.getRows());
    this.terminalIO = terminalIO;

    buffer = new char[terminalIO.getColumns() * terminalIO.getRows()];
    for (int i = 0; i < buffer.length; i++) {
      buffer[i] = ' ';
    }
  }
Beispiel #2
0
  /** {@inheritDoc} */
  public int setCursor(int x, int y) {
    try {
      terminalIO.setCursor(y, x);
      cursorOffset = getOffset(x, y);
    } catch (IOException e) {
      e.printStackTrace();
    }

    return cursorOffset;
  }
Beispiel #3
0
  /** {@inheritDoc} */
  public void sync(int offset, int length) {
    try {
      final int y = offset / getWidth();
      final int x = offset % getWidth();
      terminalIO.setCursor(y, x);

      final TelnetIO telnetIO = terminalIO.getTelnetIO();

      int offs = offset;
      for (int i = 0; i < length; i++) {
        telnetIO.write(buffer[offs++]);
      }
      if (terminalIO.isAutoflushing()) {
        terminalIO.flush();
      }
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }