java.io.Console.flush()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(4.7k)|赞(0)|评价(0)|浏览(113)

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

Console.flush介绍

暂无

代码示例

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

/** {@inheritDoc} */
  @Override public void flush() {
    delegate.flush();
  }
}

代码示例来源:origin: btraceio/btrace

con.printf("Please enter your option:\n");
con.printf("\t1. exit\n\t2. send an event\n\t3. send a named event\n\t4. flush console output\n");
con.flush();
String option = con.readLine();
option = option.trim();

代码示例来源:origin: com.atlassian.jira/jira-configurator

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

代码示例来源:origin: stackoverflow.com

for (int i = 0; i < lineSegments; i++) { 
  int whitespaces = 0;
  for (int j = 0; j < whiteSpaces; j++)
    Console.print(" ");
  Console.print("*\n");
  whitespaces++;
  Console.flush();
}

代码示例来源:origin: anba/es6draft

@Override
public void flush() {
  console.flush();
  errorWriter.flush();
}

代码示例来源:origin: beryx/text-io

@Override
  public void println() {
    console.printf("\n");
    console.flush();
  }
}

代码示例来源:origin: beryx/text-io

@Override
public void rawPrint(String message) {
  console.printf(message);
  console.flush();
}

代码示例来源:origin: anba/es6draft

@Override
public void printf(String format, Object... args) {
  console.printf(format, args);
  console.flush();
}

代码示例来源:origin: harbby/presto-connectors

@Override
public void doPrint(String msg, Object... args) {
  console.printf(msg, args);
  console.flush();
}

代码示例来源:origin: stackoverflow.com

for(int i =0; i<5000; i++){
  System.console().format("\b\b\b\b\b\b%2.2f%%", ((float) i/5000f)*100f);
  System.console().flush();
}

代码示例来源:origin: io.snappydata/gemfire-hydra-tests

private static void writeToConsole(String s) {
 System.console().writer().write(s);
 System.console().writer().flush();
 System.console().flush();
}

代码示例来源:origin: org.codehaus.izpack/izpack-util

/**
 * Flush the console output stream.
 *
 * @throws IOException if an I/O error occurs
 */
public void flush() throws IOException
{
  if (consoleReader != null)
  {
    consoleReader.flush();
  }
  else if (console != null)
  {
    console.flush();
  }
  {
    System.out.flush();
  }
}

代码示例来源:origin: org.codehaus.izpack/izpack-util

/**
 * Prints a message to the console.
 *
 * @param message the message to print
 */
public void print(String message)
{
  if (console != null)
  {
    console.printf("%s", message);
    console.flush();
  }
  else
  {
    // Fix tests
    System.out.print(message);
  }
}

代码示例来源:origin: stackoverflow.com

c.flush();
Thread.sleep(200);
  c.flush();
  c.flush();

代码示例来源:origin: sonia.jgit/org.eclipse.jgit.console

private boolean get(CredentialItem.InformationalMessage item) {
  cons.printf("%s\n", item.getPromptText()); //$NON-NLS-1$
  cons.flush();
  return true;
}

代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit.console

private boolean get(CredentialItem.InformationalMessage item) {
  cons.printf("%s\n", item.getPromptText()); //$NON-NLS-1$
  cons.flush();
  return true;
}

代码示例来源:origin: net.shibboleth.idp/idp-installer

/** {@inheritDoc} */
@Override
public void handleInput(final InputRequest arg0) {
  while (true) {
    System.console().printf("%s", arg0.getPrompt());
    System.console().flush();
    char[] result  = System.console().readPassword();
    if (null == result || result.length == 0) {
      System.console().printf("Password cannot be zero length\n");
      continue;
    }
    final String firstPass = String.copyValueOf(result);
    System.console().printf("Re-enter password: ");
    System.console().flush();
    result  = System.console().readPassword();
    if (null == result || result.length == 0) {
      System.console().printf("Password cannot be zero length\n");
      continue;
    }
    final String secondPass = String.copyValueOf(result);
    if (firstPass.equals(secondPass)) {
      arg0.setInput(firstPass);
      return;
    }
    System.console().printf("Passwords did not match\n");
  }
}

代码示例来源:origin: net.shibboleth.idp/idp-installer

while (true) {
  System.console().printf("%s", arg0.getPrompt());
  System.console().flush();
  char[] result  = System.console().readPassword();
  if (null == result || result.length == 0) {
  System.console().flush();
  result  = System.console().readPassword();
  if (null == result || result.length == 0) {

代码示例来源:origin: jbachorik/btrace2

public void handle(Signal sig) {
    try {
      con.printf("Please enter your option:\n");
      con.printf("\t1. exit\n\t2. send an event\n\t3. send a named event\n");
      con.flush();
      String option = con.readLine();
      option = option.trim();
      if (option == null) {
        return;
      }
      if (option.equals("1")) {
        System.exit(0);
      } else if (option.equals("2")) {
        BTraceLogger.debugPrint("sending event command");
        sendEvent(client);
      } else if (option.equals("3")) {
        con.printf("Please enter the event name: ");
        String name = con.readLine();
        if (name != null) {
          BTraceLogger.debugPrint("sending event command");
          sendEvent(client, name);
        }
      } else {
        con.printf("invalid option!\n");
      }
    } catch (IOException ioexp) {
      BTraceLogger.debugPrint(ioexp.toString());
    }
  }
}

相关文章