public final class ConsoleUtils
extends java.lang.Object
com.hypirion.io 0.3.0
Console
Constructor and Description |
---|
ConsoleUtils() |
Modifier and Type | Method and Description |
---|---|
static char[] |
readPassword(java.io.InputStream is)
A static method which will read from a given InputStream while it turns
echo off in the JVM console.
|
static boolean |
setEcho(boolean on)
A static method which peeks into the
Console class and
manually turns on or off echoing in the given console. |
public static boolean setEcho(boolean on) throws java.lang.NoSuchMethodException, java.lang.IllegalAccessException, java.lang.NoSuchFieldException, java.lang.reflect.InvocationTargetException
Console
class and
manually turns on or off echoing in the given console.on
- whether to set echoing on or off.java.lang.NoSuchMethodException
- if Java's own console class have no
private method named "echo".java.lang.NoSuchFieldException
- if Java's own console class have no
private field named "echoOff".java.lang.reflect.InvocationTargetException
- if Java's own console class have a
private method named "echo", but that this method tries to invoke that
method erroneously.java.lang.IllegalAccessException
- if the access restrictions prohibits
this method from modifying and using private methods in Java's own
console class.public static char[] readPassword(java.io.InputStream is) throws java.lang.NoSuchMethodException, java.lang.IllegalAccessException, java.lang.NoSuchFieldException, java.lang.reflect.InvocationTargetException, java.io.IOException
Console.readPassword(java.lang.String, java.lang.Object...)
.is
- the InputStream to read from.java.lang.NoSuchMethodException
- if Java's own console class have no
private method named "echo".java.lang.NoSuchFieldException
- if Java's own console class have no
private field named "echoOff".java.lang.reflect.InvocationTargetException
- if Java's own console class have a
private method named "echo", but that this method tries to invoke that
method erroneously.java.lang.IllegalAccessException
- if the access restrictions prohibits
setEcho(boolean)
from modifying and using private methods in
Java's own console class.java.io.IOException
- if the given InputStream
throws an
IOException
.