InputStream
is fundamentally a binary construct. If you want to read text data (e.g. from the console) you should use a Reader
of some description. To convert an InputStream
into a Reader
, use InputStreamReader
. Then create a BufferedReader
around the Reader
, and you can read a line using BufferedReader.readLine()
.
More alternatives:
- Use a
Scanner
built roundSystem.in
, and callScanner.nextLine
- Use a
Console
(obtained fromSystem.console()
) and callConsole.readLine