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

InputStreamReader does not work on the Win32 console input stream

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: 1.1
    • Fix Version/s: 1.1
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      1.1beta3
    • CPU:
      x86, sparc
    • OS:
      solaris_2.5.1, windows_95, windows_nt
    • Verification:
      Not verified

      Description

      This bug was originally reported by Steven Buroff <###@###.###>,
      who noticed that LineNumberReader throws an IOException when used on the Win32
      console input stream. Here is a simplified example, which shows that the
      problem really is that available() isn't supported by the console input stream.


      import java.io.*;

      public class ISRAvailable {

          public static void main(String[] args) {
      InputStreamReader isr = new InputStreamReader(System.in);
      int c;

      try {
      c = isr.read();
      }
      catch(IOException excp) {
      excp.printStackTrace();
      }
          }

      }


      Under Win32:

      F:\bugs\io>p:\w\jdk\build\win32\bin\java ISRAvailable
      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.InputStreamReader.read(InputStreamReader.java:249)
              at ISRAvailable.main(ISRAvailable.java:33)
      F:\bugs\io>

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              mr Mark Reinhold
              Reporter:
              mr Mark Reinhold
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: