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

java.lang.System.in.available works differently than in JDK 1.1 (win32)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Not an Issue
    • P3
    • None
    • 1.2.0
    • core-libs
    • x86
    • windows_nt

    Description



      Name: dbT83986 Date: 02/27/99


      This bug is real easy to reproduce. If you run this code with
      JDK1.1 under NT you will see letters as you type. The letters
      will show up when you hit Return. If you run the same code
      under NT with JDK1.2 you will not see letters as you type
      them. This same code works just fine under solaris
      with JDK1.1 or JDK1.2. Please fix this bug, it is a show
      stopper!


      public class echo {

          public static void main(String[] argv) throws Exception {
              System.out.println("Please begin typing");

              while (true) {

                  int avail = System.in.available();

                  if (avail == 0) {
                      Thread.currentThread().sleep(100);
                  } else {
                      byte[] buff = new byte[avail];
                      System.in.read(buff);

                      //echo back what was just typed
                      System.out.println("-----ECHO BEGIN-----");
                      System.out.write(buff);
                      System.out.println("-----ECHO END-----");
                  }

              }

          }

      }


      thanks
      Mo DeJong
      (Review ID: 52296)
      ======================================================================

      Attachments

        Activity

          People

            mmcclosksunw Michael Mccloskey (Inactive)
            dblairsunw Dave Blair (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: