Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4025513

BufferedReader constructed on System.in fails to read

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P2 P2
    • None
    • 1.1
    • core-libs
    • None
    • x86
    • windows_95



      Name: el35337 Date: 01/13/97

      If I create a BufferedReader on the System.in (STDIN) stream
      and attempt to read, I get an IO Exception. Here's some sample code
      <snip>
            BufferedReader input = new BufferedReader
               (new InputStreamReader(System.in));
            String str=input.readLine();
            System.out.println("String is: " + str);
      <snip>
      When executed, this produces the following exception stack:
      <snip>
      java.io.IOException
              at java.io.BufferedInputStream.available(BufferedInputStream.java:181)
              at java.io.InputStreamReader.fill(InputStreamReader.java:216)
              at java.io.InputStreamReader.read(InputStreamReader.java:273)
              at java.io.BufferedReader.fill(BufferedReader.java:141)
              at java.io.BufferedReader.readLine(BufferedReader.java:213)
              at intest.main(intest.java:9)
      <snip>
      Adobe Systems, Inc. ###@###.###

      ======================================================================

            mr Mark Reinhold
            elarsen Erik Larsen (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: