@ThreadSafety(level=NOT_THREADSAFE) public final class PasswordReader extends java.lang.Thread
java.io.Console.readPassword
method will be used to accomplish this.
For Java SE 5 clients, a more primitive approach must be taken, which
requires flooding standard output with backspace characters using a
high-priority thread. This has only a limited effectiveness, but it is the
best option available for older Java versions.Modifier and Type | Method and Description |
---|---|
static byte[] |
readPassword()
Reads a password from the console.
|
void |
run()
Repeatedly sends backspace and space characters to standard output in an
attempt to try to hide what the user enters.
|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
public static byte[] readPassword() throws LDAPException
LDAPException
- If a problem is encountered while trying to read
the password.public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread