org.jline.terminal.Terminal.flush()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(201)

本文整理了Java中org.jline.terminal.Terminal.flush()方法的一些代码示例,展示了Terminal.flush()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Terminal.flush()方法的具体详情如下:
包路径:org.jline.terminal.Terminal
类名称:Terminal
方法名:flush

Terminal.flush介绍

暂无

代码示例

代码示例来源:origin: confluentinc/ksql

@Override
public void flush() {
 terminal.flush();
}

代码示例来源:origin: apache/flink

private void callHelp() {
  terminal.writer().println(CliStrings.MESSAGE_HELP);
  terminal.flush();
}

代码示例来源:origin: apache/flink

private void printException(String message, Throwable t) {
  LOG.warn(message, t);
  terminal.writer().println(CliStrings.messageError(message, t).toAnsi());
  terminal.flush();
}

代码示例来源:origin: apache/flink

private void callExplain(SqlCommandCall cmdCall) {
  final String explanation;
  try {
    explanation = executor.explainStatement(context, cmdCall.operands[0]);
  } catch (SqlExecutionException e) {
    printExecutionException(e);
    return;
  }
  terminal.writer().println(explanation);
  terminal.flush();
}

代码示例来源:origin: apache/flink

private void printInfo(String message) {
    terminal.writer().println(CliStrings.messageInfo(message).toAnsi());
    terminal.flush();
  }
}

代码示例来源:origin: apache/flink

private void printExecutionError(String message) {
  terminal.writer().println(CliStrings.messageError(CliStrings.MESSAGE_SQL_EXECUTION_ERROR, message).toAnsi());
  terminal.flush();
}

代码示例来源:origin: apache/flink

private void printError(String message) {
  terminal.writer().println(CliStrings.messageError(message).toAnsi());
  terminal.flush();
}

代码示例来源:origin: apache/flink

private void callShowTables() {
  final List<String> tables;
  try {
    tables = executor.listTables(context);
  } catch (SqlExecutionException e) {
    printExecutionException(e);
    return;
  }
  if (tables.isEmpty()) {
    terminal.writer().println(CliStrings.messageInfo(CliStrings.MESSAGE_EMPTY).toAnsi());
  } else {
    tables.forEach((v) -> terminal.writer().println(v));
  }
  terminal.flush();
}

代码示例来源:origin: apache/flink

private void callDescribe(SqlCommandCall cmdCall) {
  final TableSchema schema;
  try {
    schema = executor.getTableSchema(context, cmdCall.operands[0]);
  } catch (SqlExecutionException e) {
    printExecutionException(e);
    return;
  }
  terminal.writer().println(schema.toString());
  terminal.flush();
}

代码示例来源:origin: apache/flink

private void callShowFunctions() {
  final List<String> functions;
  try {
    functions = executor.listUserDefinedFunctions(context);
  } catch (SqlExecutionException e) {
    printExecutionException(e);
    return;
  }
  if (functions.isEmpty()) {
    terminal.writer().println(CliStrings.messageInfo(CliStrings.MESSAGE_EMPTY).toAnsi());
  } else {
    functions.forEach((v) -> terminal.writer().println(v));
  }
  terminal.flush();
}

代码示例来源:origin: apache/flink

private void callSet(SqlCommandCall cmdCall) {
  // show all properties
  if (cmdCall.operands.length == 0) {
    final Map<String, String> properties;
    try {
      properties = executor.getSessionProperties(context);
    } catch (SqlExecutionException e) {
      printExecutionException(e);
      return;
    }
    if (properties.isEmpty()) {
      terminal.writer().println(CliStrings.messageInfo(CliStrings.MESSAGE_EMPTY).toAnsi());
    } else {
      properties
        .entrySet()
        .stream()
        .map((e) -> e.getKey() + "=" + e.getValue())
        .sorted()
        .forEach((p) -> terminal.writer().println(p));
    }
  }
  // set a property
  else {
    context.setSessionProperty(cmdCall.operands[0], cmdCall.operands[1]);
    terminal.writer().println(CliStrings.messageInfo(CliStrings.MESSAGE_SET).toAnsi());
  }
  terminal.flush();
}

代码示例来源:origin: apache/flink

private void callSource(SqlCommandCall cmdCall) {
  final String pathString = cmdCall.operands[0];
  // load file
  final String stmt;
  try {
    final Path path = Paths.get(pathString);
    byte[] encoded = Files.readAllBytes(path);
    stmt = new String(encoded, Charset.defaultCharset());
  } catch (IOException e) {
    printExecutionException(e);
    return;
  }
  // limit the output a bit
  if (stmt.length() > SOURCE_MAX_SIZE) {
    printExecutionError(CliStrings.MESSAGE_MAX_SIZE_EXCEEDED);
    return;
  }
  terminal.writer().println(CliStrings.messageInfo(CliStrings.MESSAGE_WILL_EXECUTE).toAnsi());
  terminal.writer().println(new AttributedString(stmt).toString());
  terminal.flush();
  // try to run it
  final Optional<SqlCommandCall> call = parseCommand(stmt);
  call.ifPresent(this::callCommand);
}

代码示例来源:origin: apache/flink

terminal.flush();

代码示例来源:origin: apache/flink

private boolean callInsertInto(SqlCommandCall cmdCall) {
  printInfo(CliStrings.MESSAGE_SUBMITTING_STATEMENT);
  try {
    final ProgramTargetDescriptor programTarget = executor.executeUpdate(context, cmdCall.operands[0]);
    terminal.writer().println(CliStrings.messageInfo(CliStrings.MESSAGE_STATEMENT_SUBMITTED).toAnsi());
    terminal.writer().println(programTarget.toString());
    terminal.flush();
  } catch (SqlExecutionException e) {
    printExecutionException(e);
    return false;
  }
  return true;
}

代码示例来源:origin: apache/flink

/**
 * Submits a SQL update statement and prints status information and/or errors on the terminal.
 *
 * @param statement SQL update statement
 * @return flag to indicate if the submission was successful or not
 */
public boolean submitUpdate(String statement) {
  terminal.writer().println(CliStrings.messageInfo(CliStrings.MESSAGE_WILL_EXECUTE).toAnsi());
  terminal.writer().println(new AttributedString(statement).toString());
  terminal.flush();
  final Optional<SqlCommandCall> parsedStatement = parseCommand(statement);
  // only support INSERT INTO
  return parsedStatement.map(cmdCall -> {
    switch (cmdCall.command) {
      case INSERT_INTO:
        return callInsertInto(cmdCall);
      default:
        printError(CliStrings.MESSAGE_UNSUPPORTED_SQL);
        return false;
    }
  }).orElse(false);
}

代码示例来源:origin: apache/flink

client.getTerminal().flush();

代码示例来源:origin: org.jline/jline

/**
 * Flush the terminal output stream. This is important for printout out single
 * characters (like a buf.backspace or keyboard) that we want the terminal to
 * handle immediately.
 */
public void flush() {
  terminal.flush();
}

代码示例来源:origin: com.aspectran/aspectran-shell-jline

@Override
public void clearScreen() {
  terminal.puts(InfoCmp.Capability.clear_screen);
  terminal.flush();
}

代码示例来源:origin: apache/samza

private void updateTerminalSize() {
 terminal.flush();
 height = terminal.getHeight();
}

代码示例来源:origin: batfish/batfish

private boolean clearScreen(List<String> options, List<String> parameters) {
 if (!isValidArgument(options, parameters, 0, 0, 0, Command.CLEAR_SCREEN)) {
  return false;
 }
 _reader.getTerminal().puts(Capability.clear_screen);
 _reader.getTerminal().flush();
 return false;
}

相关文章