public class ConsoleInterfaceDevice extends AbstractTextInterfaceDevice
TextInterfaceDevice. This is the only implementation currently used by the
LicenseManager in production environments, and wraps all of the methods in Console and the exit
method in Runtime.Console and Runtime because this implementation wraps the methods of those
classes.err, in, outCONSOLE| Constructor and Description |
|---|
ConsoleInterfaceDevice() |
| Modifier and Type | Method and Description |
|---|---|
void |
exit(int exitCode)
Terminates the currently running application.
|
void |
flush()
Flushes this device by writing any buffered output to the underlying stream.
|
TextInterfaceDevice |
format(String format,
Object... arguments)
Writes a formatted string to this device's output stream using the specified format string and arguments.
|
Console |
getConsole()
Gets the console object in use by this device.
|
Reader |
getReader()
Retrieves the unique Reader object associated with this interface device.
|
Runtime |
getRuntime()
Gets the runtime object in use by this device.
|
PrintWriter |
getWriter()
Retrieves the unique PrintWriter object associated with this interface device.
|
TextInterfaceDevice |
printf(String format,
Object... arguments)
A convenience method to write a formatted string to this device's output stream using the specified format
string and arguments.
|
String |
readLine()
Reads a single line of text from the device.
|
String |
readLine(String format,
Object... arguments)
Provides a formatted prompt, then reads a single line of text from the device.
|
char[] |
readPassword()
Reads a password or passphrase from the device with echoing disabled.
|
char[] |
readPassword(String format,
Object... arguments)
Provides a formatted prompt, then reads a password or passphrase from the device with echoing disabled.
|
void |
registerShutdownHook(Thread hook)
Registers a new application shutdown hook.
|
boolean |
unregisterShutdownHook(Thread hook)
De-registers a previously-registered application shutdown hook.
|
err, exit, in, out, outputErrorMessage, outputMessage, printErr, printErr, printErr, printErrLn, printErrLn, printErrLn, printErrLn, printOut, printOut, printOut, printOutLn, printOutLn, printOutLn, printOutLn, promptForValidPasswordpasswordsMatch, promptForValidPasswordclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpasswordsMatch, promptForValidPasswordpublic void exit(int exitCode)
Runtime.exit(int).exitCode - The exit status to exit withpublic void registerShutdownHook(Thread hook) throws IllegalArgumentException, IllegalStateException, SecurityException
Runtime.addShutdownHook(Thread).Runtime.addShutdownHook(Thread).hook - An initialized but unstarted Thread objectIllegalArgumentException - if the specified hook has already been registered, or if it can be determined that the hook is already running or has already been run.IllegalStateException - if the application is already in the process of shutting down.SecurityException - if registering shutdown hooks is forbidden.public boolean unregisterShutdownHook(Thread hook) throws IllegalStateException, SecurityException
Runtime.removeShutdownHook(Thread).hook - The hook to removetrue if the specified hook had previously been registered and was successfully de-registered, false otherwiseIllegalStateException - if the virtual machine is already in the process of shutting down.SecurityException - if registering shutdown hooks is forbidden.public TextInterfaceDevice format(String format, Object... arguments) throws IllegalFormatException
Console.format(String, Object...).format - A format string as described in #syntaxarguments - Arguments referenced by the format specifiers in the format string. If there are more arguments than format specifiers, the extra arguments are ignored. The number of arguments is variable and may be zero. The maximum number of arguments is limited by the maximum dimension of a Java array as defined by the Java Virtual Machine Specification. The behaviour on a null argument depends on the conversion.IllegalFormatException - - if a format string contains an illegal syntax, a format specifier that is incompatible with the given arguments, insufficient arguments given the format string, or other illegal conditions. For specification of all possible formatting errors, see the Details section of the formatter class specification.public TextInterfaceDevice printf(String format, Object... arguments) throws IllegalFormatException, IOError
device.printf(format, args) behaves in exactly the same way as
the invocation of device.format(format, args).Console.printf(String, Object...).format - A format string as described in #syntaxarguments - Arguments referenced by the format specifiers in the format string. If there are more arguments than format specifiers, the extra arguments are ignored. The number of arguments is variable and may be zero. The maximum number of arguments is limited by the maximum dimension of a Java array as defined by the Java Virtual Machine Specification. The behaviour on a null argument depends on the conversion.IllegalFormatException - if a format string contains an illegal syntax, a format specifier that is incompatible with the given arguments, insufficient arguments given the format string, or other illegal conditions. For specification of all possible formatting errors, see the Details section of the formatter class specification.IOError - if an I/O error occurs.public void flush()
Console.flush().public String readLine() throws IOError
null if an end of stream has been reached.IOError - if an I/O error occurs.public String readLine(String format, Object... arguments) throws IllegalFormatException, IOError
Console.readLine(String, Object...).format - A format string as described in #syntaxarguments - Arguments referenced by the format specifiers in the format string. If there are more arguments than format specifiers, the extra arguments are ignored. The number of arguments is variable and may be zero. The maximum number of arguments is limited by the maximum dimension of a Java array as defined by the Java Virtual Machine Specification. The behaviour on a null argument depends on the conversion.null if an end of stream has been reached.IllegalFormatException - if a format string contains an illegal syntax, a format specifier that is incompatible with the given arguments, insufficient arguments given the format string, or other illegal conditions. For specification of all possible formatting errors, see the Details section of the formatter class specification.IOError - if an I/O error occurs.public char[] readPassword()
throws IOError
Console.readPassword().null if an end of stream has been reached.IOError - if an I/O error occurs.public char[] readPassword(String format, Object... arguments) throws IllegalFormatException, IOError
Console.readPassword(String, Object...).format - A format string as described in #syntaxarguments - Arguments referenced by the format specifiers in the format string. If there are more arguments than format specifiers, the extra arguments are ignored. The number of arguments is variable and may be zero. The maximum number of arguments is limited by the maximum dimension of a Java array as defined by the Java Virtual Machine Specification. The behaviour on a null argument depends on the conversion.null if an end of stream has been reached.IllegalFormatException - if a format string contains an illegal syntax, a format specifier that is incompatible with the given arguments, insufficient arguments given the format string, or other illegal conditions. For specification of all possible formatting errors, see the Details section of the formatter class specification.IOError - if an I/O error occurs.public Reader getReader()
Console.reader().Console.reader().public PrintWriter getWriter()
Console.writer().public Console getConsole()
public Runtime getRuntime()
Copyright © 2010-2013 NWTS Java Code. All Rights Reserved. Licensed Under the Apache License version 2.0.