@ThreadSafety(level=NOT_THREADSAFE) public final class PasswordReader extends java.lang.Object
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 as a byte array.
|
static char[] |
readPasswordChars()
Reads a password from the console as a character array.
|
void |
run()
Deprecated.
This method is no longer used.
|
static void |
setTestReader(java.io.BufferedReader reader)
Specifies the input stream from which to read the password.
|
static void |
setTestReaderLines(java.lang.String... lines)
Specifies the lines that should be used as input when reading the password.
|
@NotNull public static char[] readPasswordChars() throws LDAPException
LDAPException
- If a problem is encountered while trying to read
the password.@NotNull public static byte[] readPassword() throws LDAPException
LDAPException
- If a problem is encountered while trying to read
the password.@Deprecated public void run()
@InternalUseOnly public static void setTestReaderLines(@NotNull java.lang.String... lines)
setTestReader(BufferedReader)
method should be called with a value
of null
before the end of the test to ensure that the password
reader is reverted back to its normal behavior.lines
- The lines of input that should be provided to the password
reader instead of actually obtaining them interactively.
It must not be null
but may be empty.@InternalUseOnly public static void setTestReader(@Nullable java.io.BufferedReader reader)
null
before the end of the test to ensure
that the password reader is reverted back to its normal behavior.reader
- The input stream from which to read the password. It may
be null
to obtain the password from the normal
means.