Examples of Console


Examples of java.io.Console

    };

    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

Examples of java.io.Console

    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

Examples of java.io.Console

    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

Examples of java.io.Console

    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

Examples of java.io.Console

    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

Examples of java.io.Console

    }
  }
 
  @Override
  public boolean promptForIdentity(String message) {
    final Console console = System.console();
    showHeader(console);
   
    final String line = console.readLine("# %s [~/.ssh/id_pub]: ", message);
    final File home = new File(System.getProperty("java.home"));
   
    if (line == null || line.length() == 0) {
      identity = new File(home, ".ssh/id_pub").getAbsolutePath();
      return true;
View Full Code Here

Examples of java.io.Console

    return true;
  }

  @Override
  public void showMessage(String message) {
    final Console console = System.console();
    showHeader(console);
    console.printf("# %s\n#\n", message);
  }
View Full Code Here

Examples of java.io.Console

  public static String[] create(String title, String description, String username, String password) {
    if (!GraphicsEnvironment.isHeadless()) {
      return swingCredentialsDialog(title, description, username, password);
    }

    final Console console = System.console();
    console.printf("#\n# %s\n# %s\n#\n", title, description);
    final String user = console.readLine("# %s: ", username);
    final char[] pass = console.readPassword("# %s: ", password);
    console.printf("#\n");

    return new String[] { user, new String(pass) };
  }
View Full Code Here

Examples of java.io.Console

    public static char[] getSensitiveValue(String passwordPrompt) {
        while (true) {
            if (passwordPrompt == null)
                passwordPrompt = "Enter your password";

            Console console = System.console();

            char[] passwd = console.readPassword(passwordPrompt + ": ");
            char[] passwd1 = console.readPassword(passwordPrompt + " again: ");
            boolean noMatch = !Arrays.equals(passwd, passwd1);
            if (noMatch)
                System.out.println("Values entered don't match");
            else {
                System.out.println("Values match");
View Full Code Here

Examples of java.io.Console

    public VaultInteractiveSession() {
    }

    public void start() {
        Console console = System.console();

        if (console == null) {
            System.err.println("No console.");
            System.exit(1);
        }

        while (encDir == null || encDir.length() == 0 || !(encDir.endsWith("/") || encDir.endsWith("\\"))) {
            encDir = console
                    .readLine("Enter directory to store encrypted files (end with either / or \\ based on Unix or Windows:");
        }

        while (keystoreURL == null || keystoreURL.length() == 0) {
            keystoreURL = console.readLine("Enter Keystore URL:");
        }

        char[] keystorePasswd = getSensitiveValue("Enter Keystore password");

        try {
            maskedPassword = getMaskedPassword(console, new String(keystorePasswd));
            System.out.println("                ");
            System.out.println("Please make note of the following:");
            System.out.println("********************************************");
            System.out.println("Masked Password:" + maskedPassword);
            System.out.println("salt:" + salt);
            System.out.println("Iteration Count:" + iterationCount);
            System.out.println("********************************************");
            System.out.println("                ");
        } catch (Exception e) {
            System.out.println("Exception encountered:" + e.getLocalizedMessage());
        }

        while (keystoreAlias == null || keystoreAlias.length() == 0) {
            keystoreAlias = console.readLine("Enter Keystore Alias:");
        }

        try {
            vault = SecurityVaultFactory.get();
            System.out.println("Obtained Vault");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.