Java Reference
In-Depth Information
Table 10-8
The Methods Defined by
Writer
Console Input Using Character Streams
For code that will be internationalized, inputting from the console using Java's character-
based streams is a better, more convenient way to read characters from the keyboard than
is using the byte streams. However, since
System.in
is a byte stream, you will need to
wrap
System.in
inside some type of
Reader
. The best class for reading console input is
BufferedReader
, which supports a buffered input stream. However, you cannot construct a
BufferedReader
directly from
System.in
. Instead, you must first convert it into a character
stream. To do this, you will use
InputStreamReader
, which converts bytes to characters.