public Reader reader ()

Retrieves the unique Reader object associated with this console.

This method is intended to be used by sophisticated applications, for example, a java.util.Scanner object which utilizes the rich parsing/scanning functionality provided by the Scanner:

 Console con = System.console();
 if (con != null) {
     Scanner sc = new Scanner(con.reader());
     ...
 }
 

For simple applications requiring only line-oriented reading, use readLine.

The bulk read operations read(char[]), read(char[], int, int) and 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 Reader's 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 ( '\n'), a carriage return ( '\r'), a carriage return followed immediately by a linefeed, or an end of stream.

Returns:  The reader associated with this console