< prev index next >
src/java.base/share/classes/java/io/Console.java
Print this page
@@ -45,30 +45,30 @@
* have a console.
* <p>
* If this virtual machine has a console then it is represented by a
* unique instance of this class which can be obtained by invoking the
* {@link java.lang.System#console()} method. If no console device is
- * available then an invocation of that method will return <tt>null</tt>.
+ * available then an invocation of that method will return {@code null}.
* <p>
* Read and write operations are synchronized to guarantee the atomic
* completion of critical operations; therefore invoking methods
* {@link #readLine()}, {@link #readPassword()}, {@link #format format()},
* {@link #printf printf()} as well as the read, format and write operations
* on the objects returned by {@link #reader()} and {@link #writer()} may
* block in multithreaded scenarios.
* <p>
- * Invoking <tt>close()</tt> on the objects returned by the {@link #reader()}
+ * Invoking {@code close()} on the objects returned by the {@link #reader()}
* and the {@link #writer()} will not close the underlying stream of those
* objects.
* <p>
- * The console-read methods return <tt>null</tt> when the end of the
+ * The console-read methods return {@code null} when the end of the
* console input stream is reached, for example by typing control-D on
* Unix or control-Z on Windows. Subsequent read operations will succeed
* if additional characters are later entered on the console's input
* device.
* <p>
- * Unless otherwise specified, passing a <tt>null</tt> argument to any method
+ * Unless otherwise specified, passing a {@code null} argument to any method
* in this class will cause a {@link NullPointerException} to be thrown.
* <p>
* <b>Security note:</b>
* If an application needs to read a password or other secure data, it should
* use {@link #readPassword()} or {@link #readPassword(String, Object...)} and
@@ -105,31 +105,31 @@
* Retrieves the unique {@link java.io.Reader Reader} object associated
* with this console.
* <p>
* This method is intended to be used by sophisticated applications, for
* example, a {@link java.util.Scanner} object which utilizes the rich
- * parsing/scanning functionality provided by the <tt>Scanner</tt>:
+ * parsing/scanning functionality provided by the {@code Scanner}:
* <blockquote><pre>
* Console con = System.console();
* if (con != null) {
* Scanner sc = new Scanner(con.reader());
* ...
* }
* </pre></blockquote>
* <p>
* For simple applications requiring only line-oriented reading, use
- * <tt>{@link #readLine}</tt>.
+ * <code>{@link #readLine}</code>.
* <p>
* The bulk read operations {@link java.io.Reader#read(char[]) read(char[]) },
* {@link java.io.Reader#read(char[], int, int) read(char[], int, int) } and
* {@link java.io.Reader#read(java.nio.CharBuffer) read(java.nio.CharBuffer)}
* on the returned object will not read in characters beyond the line
* bound for each invocation, even if the destination buffer has space for
* more characters. The {@code Reader}'s {@code read} methods may block if a
* line bound has not been entered or reached on the console's input device.
- * A line bound is considered to be any one of a line feed (<tt>'\n'</tt>),
- * a carriage return (<tt>'\r'</tt>), a carriage return followed immediately
+ * A line bound is considered to be any one of a line feed ({@code '\n'}),
+ * a carriage return ({@code '\r'}), a carriage return followed immediately
* by a linefeed, or an end of stream.
*
* @return The reader associated with this console
*/
public Reader reader() {
@@ -150,11 +150,11 @@
* 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
* <cite>The Java™ Virtual Machine Specification</cite>.
* The behaviour on a
- * <tt>null</tt> argument depends on the <a
+ * {@code null} argument depends on the <a
* href="../util/Formatter.html#syntax">conversion</a>.
*
* @throws IllegalFormatException
* If a format string contains an illegal syntax, a format
* specifier that is incompatible with the given arguments,
@@ -173,12 +173,13 @@
/**
* A convenience method to write a formatted string to this console's
* output stream using the specified format string and arguments.
*
- * <p> An invocation of this method of the form <tt>con.printf(format,
- * args)</tt> behaves in exactly the same way as the invocation of
+ * <p> An invocation of this method of the form
+ * {@code con.printf(format, args)} behaves in exactly the same way
+ * as the invocation of
* <pre>con.format(format, args)</pre>.
*
* @param format
* A format string as described in <a
* href="../util/Formatter.html#syntax">Format string syntax</a>.
@@ -189,11 +190,11 @@
* 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
* <cite>The Java™ Virtual Machine Specification</cite>.
* The behaviour on a
- * <tt>null</tt> argument depends on the <a
+ * {@code null} argument depends on the <a
* href="../util/Formatter.html#syntax">conversion</a>.
*
* @throws IllegalFormatException
* If a format string contains an illegal syntax, a format
* specifier that is incompatible with the given arguments,
@@ -235,11 +236,11 @@
*
* @throws IOError
* If an I/O error occurs.
*
* @return A string containing the line read from the console, not
- * including any line-termination characters, or <tt>null</tt>
+ * including any line-termination characters, or {@code null}
* if an end of stream has been reached.
*/
public String readLine(String fmt, Object ... args) {
String line = null;
synchronized (writeLock) {
@@ -263,11 +264,11 @@
*
* @throws IOError
* If an I/O error occurs.
*
* @return A string containing the line read from the console, not
- * including any line-termination characters, or <tt>null</tt>
+ * including any line-termination characters, or {@code null}
* if an end of stream has been reached.
*/
public String readLine() {
return readLine("");
}
@@ -300,11 +301,11 @@
* @throws IOError
* If an I/O error occurs.
*
* @return A character array containing the password or passphrase read
* from the console, not including any line-termination characters,
- * or <tt>null</tt> if an end of stream has been reached.
+ * or {@code null} if an end of stream has been reached.
*/
public char[] readPassword(String fmt, Object ... args) {
char[] passwd = null;
synchronized (writeLock) {
synchronized(readLock) {
@@ -344,11 +345,11 @@
* @throws IOError
* If an I/O error occurs.
*
* @return A character array containing the password or passphrase read
* from the console, not including any line-termination characters,
- * or <tt>null</tt> if an end of stream has been reached.
+ * or {@code null} if an end of stream has been reached.
*/
public char[] readPassword() {
return readPassword("");
}
< prev index next >