|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnl.nikhef.slcshttps.util.PasswordReader
public class PasswordReader
PasswordReader reads a password and masks the typed inputs, only needed when
we use JDK1.5, for 1.6 use java.io.Console.readPassword().
Taken over from Valery Tschopp's org.glite.slcs.ui package,
removing main() method.
See also the article:
Password Masking in the Java Programming Language.
ConsoleTools.getPassword(String)| Field Summary | |
|---|---|
private char |
echochar
Character to use for masking. |
private boolean |
masking
Indicate whether characters are masked. |
| Constructor Summary | |
|---|---|
private |
PasswordReader(String prompt)
Constructs a PasswordReader using the given prompt. |
| Method Summary | |
|---|---|
static char[] |
getPassword(InputStream in,
String prompt)
Obtains a password from given InputStream. |
void |
run()
Begin masking until asked to stop. |
private void |
setEchoChar(char c)
Sets the char to replace input (mask). |
private void |
stopMasking()
Instruct the thread to stop masking. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private volatile boolean masking
private char echochar
| Constructor Detail |
|---|
private PasswordReader(String prompt)
prompt - String displayed to the user.| Method Detail |
|---|
public static final char[] getPassword(InputStream in,
String prompt)
throws IOException
InputStream.
in - InputStream to read fromprompt - String to print first
IOException - upon errorpublic void run()
run in interface Runnableprivate void stopMasking()
private void setEchoChar(char c)
c - character for masking.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
| nl.nikhef.slcshttps | Mischa Sallé - msalle(AT)nikhef.nl |