Package java.io

Examples of java.io.Console.readPassword()


        System.exit(1);
    }
 
    boolean noMatch;
    do {
        char [] newPassword1 = c.readPassword("Enter master secret: ");
        char [] newPassword2 = c.readPassword("Enter master secret again: ");
        noMatch = ! Arrays.equals(newPassword1, newPassword2);
        if (noMatch) {
            c.format("Passwords don't match. Try again.%n");
        } else {
View Full Code Here


    }
 
    boolean noMatch;
    do {
        char [] newPassword1 = c.readPassword("Enter master secret: ");
        char [] newPassword2 = c.readPassword("Enter master secret again: ");
        noMatch = ! Arrays.equals(newPassword1, newPassword2);
        if (noMatch) {
            c.format("Passwords don't match. Try again.%n");
        } else {
            this.master = Arrays.copyOf(newPassword1, newPassword1.length);
View Full Code Here

            Console console = System.console();
            if (console == null) {
              throw new ParameterException("No console is available to get parameter " + a);
            }
            System.out.print("Value for " + a + " (" + pd.getDescription() + "):");
            char[] password = console.readPassword();
            pd.addValue(new String(password));
          } else {
            //
            // Regular option
            //
View Full Code Here

            Console console = System.console();
            if (console == null) {
                return null;    // no terminal
            }

            char[] w = console.readPassword("Password:");
            if (w == null) {
                return null;
            }
            return new String(w);
        }
View Full Code Here

  public static void main(String[] args){
    Console cons;
//    passwd = System.console().readPassword();
     if ((cons = System.console()) != null &&
         (passwd = cons.readPassword("[%s]", "Password:")) != null) {
        
     }
     System.out.println("The entered password is:");
     dclong.io.Console.print(passwd,"");
     System.out.println();
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.