java.lang.Object | |
↳ | java.io.Console |
Provides access to the console, if available. The system-wide instance can
be accessed via console()
.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Flushes the object by writing out any buffered data to the underlying
output.
| |||||||||||
Writes a formatted string to the console using
the specified format string and arguments.
| |||||||||||
Equivalent to
format(format, args) . | |||||||||||
Reads a line from this console, using the specified prompt.
| |||||||||||
Reads a line from the console.
| |||||||||||
Reads a password from the console.
| |||||||||||
Reads a password from the console.
| |||||||||||
Returns the
Reader associated with this console. | |||||||||||
Returns the
Writer associated with this console. |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class java.lang.Object
| |||||||||||
From interface java.io.Flushable
|
Flushes the object by writing out any buffered data to the underlying output.
Writes a formatted string to the console using the specified format string and arguments.
format | the format string (see format(String, Object...) ) |
---|---|
args | the list of arguments passed to the formatter. If there are
more arguments than required by format ,
additional arguments are ignored. |
Equivalent to format(format, args)
.
Reads a line from this console, using the specified prompt.
The prompt is given as a format string and optional arguments.
Note that this can be a source of errors: if it is possible that your
prompt contains %
characters, you must use the format string "%s"
and pass the actual prompt as a parameter.
format | the format string (see format(String, Object...) ) |
---|---|
args | the list of arguments passed to the formatter. If there are
more arguments than required by format ,
additional arguments are ignored. |
Reads a line from the console.
Reads a password from the console. The password will not be echoed to the display. A formatted prompt is also displayed.
format | the format string (see format(String, Object...) ) |
---|---|
args | the list of arguments passed to the formatter. If there are
more arguments than required by format ,
additional arguments are ignored. |
Reads a password from the console. The password will not be echoed to the display.