Package java.io

Examples of java.io.Console$ConsoleReader


       if (_cmd.hasOption(BST_PASSWORD_OPT_CHAR))
       {
         String pwd = _cmd.getOptionValue(BST_PASSWORD_OPT_CHAR);
         if (null == pwd)
         {
           Console console = System.console();
           if (null == console)
           {
             printError("no password specified", true);
             return false;
           }
           char[] pwdChars = console.readPassword("Enter bootstrap MySQL password:");
           if (null == pwdChars)
           {
             printError("no password specified", true);
             return false;
           }
View Full Code Here


            }
        }
    }

    public static void main(String[] args) {
        Console con = System.console();
        FootballManager manager = new FootballManager(System.console());
        con.printf(initialPrompt);

        while (true) {
            String action = con.readLine(">");
            if ("at".equals(action)) {
                manager.addTeam();
            } else if ("ap".equals(action)) {
                manager.addPlayers();
            } else if ("rt".equals(action)) {
View Full Code Here

    public void stop() {
        cacheManager.stop();
    }

    public static void main(String[] args) {
        Console con = System.console();
        FootballManager manager = new FootballManager(System.console());
        con.printf(initialPrompt);

        while (true) {
            String action = con.readLine(">");
            if ("at".equals(action)) {
                manager.addTeam();
            } else if ("ap".equals(action)) {
                manager.addPlayers();
            } else if ("rt".equals(action)) {
View Full Code Here

            }
        }
    }

    public static void main(String[] args) {
        Console con = System.console();
        FootballManager manager = new FootballManager(System.console());
        con.printf(initialPrompt);

        while (true) {
            String action = con.readLine(">");
            if ("at".equals(action)) {
                manager.addTeam();
            } else if ("ap".equals(action)) {
                manager.addPlayers();
            } else if ("rt".equals(action)) {
View Full Code Here

        return false;
    }
   
    private static String askForPasswd(String filePath){
        try {
            Console cons = System.console();
            String passwd = null;
            if (cons != null){
                char[] p = cons.readPassword("%s", "Enter passphrase for "+filePath+":");
                passwd = String.valueOf(p);
            }
            return passwd;
        } catch (LinkageError e) {
            throw new Error("Your private key is encrypted, but we need Java6 to ask you password safely",e);
View Full Code Here

    };

    int index = 0;
    byte htl = Probe.MAX_HTL;
    BufferedReader r;
    Console console = System.console();
    if(console != null)
      r = new BufferedReader(console.reader());
    else
      r = new BufferedReader(new InputStreamReader(System.in)); // Use the system locale here.
    while (true) {
      System.err.println("Sending probes from node " + index + " with HTL " + htl + ".");
      System.err.println("0) BANDWIDTH");
View Full Code Here

    return identity;
  }

  @Override
  public boolean promptPassphrase(String message) {
    final Console console = System.console();
    showHeader(console);
    passphrase = new String(console.readPassword("# %s: ", message));
    return passphrase.length() > 0;
  }
View Full Code Here

    return passphrase.length() > 0;
  }

  @Override
  public boolean promptPassword(String message) {
    final Console console = System.console();
    showHeader(console);
    password = new String(console.readPassword("# %s: ", message));
    return password.length() > 0;   
  }
View Full Code Here

    return password.length() > 0;   
  }
 
  @Override
  public boolean promptUsername(String message) {
    final Console console = System.console();
    showHeader(console);
    username = console.readLine("# %s: ", message);
    return username.length() > 0;   
 
View Full Code Here

    return username.length() > 0;   
 

  @Override
  public boolean promptYesNo(String message) {
    final Console console = System.console();
    showHeader(console);
   
    String line;
    while (true) {
      line = console.readLine("# %s [yes/no]: ", message);
      if ("yes".equalsIgnoreCase(line) || "y".equalsIgnoreCase(line)) {
        return true;
      }
      if ("no".equalsIgnoreCase(line) || "n".equalsIgnoreCase(line)) {
        return false;
      }
      console.printf("# ERROR: Please answer yes or no\n#\n");
    }
  }
View Full Code Here

TOP

Related Classes of java.io.Console$ConsoleReader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.