107 * <p> 108 * This method is intended to be used by sophisticated applications, for 109 * example, a {@link java.util.Scanner} object which utilizes the rich 110 * parsing/scanning functionality provided by the <tt>Scanner</tt>: 111 * <blockquote><pre> 112 * Console con = System.console(); 113 * if (con != null) { 114 * Scanner sc = new Scanner(con.reader()); 115 * ... 116 * } 117 * </pre></blockquote> 118 * <p> 119 * For simple applications requiring only line-oriented reading, use 120 * <tt>{@link #readLine}</tt>. 121 * <p> 122 * The bulk read operations {@link java.io.Reader#read(char[]) read(char[]) }, 123 * {@link java.io.Reader#read(char[], int, int) read(char[], int, int) } and 124 * {@link java.io.Reader#read(java.nio.CharBuffer) read(java.nio.CharBuffer)} 125 * on the returned object will not read in characters beyond the line 126 * bound for each invocation, even if the destination buffer has space for 127 * more characters. A line bound is considered to be any one of a line feed 128 * (<tt>'\n'</tt>), a carriage return (<tt>'\r'</tt>), a carriage return 129 * followed immediately by a linefeed, or an end of stream. 130 * 131 * @return The reader associated with this console 132 */ 133 public Reader reader() { 134 return reader; 135 } 136 137 /** 138 * Writes a formatted string to this console's output stream using 139 * the specified format string and arguments. 140 * 141 * @param fmt 142 * A format string as described in <a 143 * href="../util/Formatter.html#syntax">Format string syntax</a> 144 * 145 * @param args 146 * Arguments referenced by the format specifiers in the format 147 * string. If there are more arguments than format specifiers, the 148 * extra arguments are ignored. The number of arguments is 149 * variable and may be zero. The maximum number of arguments is | 107 * <p> 108 * This method is intended to be used by sophisticated applications, for 109 * example, a {@link java.util.Scanner} object which utilizes the rich 110 * parsing/scanning functionality provided by the <tt>Scanner</tt>: 111 * <blockquote><pre> 112 * Console con = System.console(); 113 * if (con != null) { 114 * Scanner sc = new Scanner(con.reader()); 115 * ... 116 * } 117 * </pre></blockquote> 118 * <p> 119 * For simple applications requiring only line-oriented reading, use 120 * <tt>{@link #readLine}</tt>. 121 * <p> 122 * The bulk read operations {@link java.io.Reader#read(char[]) read(char[]) }, 123 * {@link java.io.Reader#read(char[], int, int) read(char[], int, int) } and 124 * {@link java.io.Reader#read(java.nio.CharBuffer) read(java.nio.CharBuffer)} 125 * on the returned object will not read in characters beyond the line 126 * bound for each invocation, even if the destination buffer has space for 127 * more characters. The {@code Reader}'s {@code read} methods may block if a 128 * line bound has not been entered or reached on the console's input device. 129 * A line bound is considered to be any one of a line feed (<tt>'\n'</tt>), 130 * a carriage return (<tt>'\r'</tt>), a carriage return followed immediately 131 * by a linefeed, or an end of stream. 132 * 133 * @return The reader associated with this console 134 */ 135 public Reader reader() { 136 return reader; 137 } 138 139 /** 140 * Writes a formatted string to this console's output stream using 141 * the specified format string and arguments. 142 * 143 * @param fmt 144 * A format string as described in <a 145 * href="../util/Formatter.html#syntax">Format string syntax</a> 146 * 147 * @param args 148 * Arguments referenced by the format specifiers in the format 149 * string. If there are more arguments than format specifiers, the 150 * extra arguments are ignored. The number of arguments is 151 * variable and may be zero. The maximum number of arguments is |