Added method to read password from console

Signed-off-by: Jim Martens <github@2martens.de>
This commit is contained in:
Jim Martens 2017-04-18 19:36:41 +02:00
parent 650f75dd14
commit 665d551b77
1 changed files with 12 additions and 0 deletions

View File

@ -27,6 +27,18 @@ public class FormUtil {
return ret;
}
/**
* Reads a password from the console.
*
* @return the entered password
*/
static String readPassword() {
String password;
System.out.print("Password: ");
password = String.valueOf(System.console().readPassword());
return password;
}
/**
* Reads an integer from the console.