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

BufferedInputStream does not flush even when the program exits

XMLWordPrintable

    • generic
    • generic

      BufferedInputStream does not flush even when the program exits.

      Test Program T1.java
      ----------------
      import java.io.*;

      class T1 {
          public static void main(String argv[]){
              BufferedOutputStream b;
              String filename;
              String outstr;
       
              filename = "/tmp/b";
              outstr = "Hello";
              try {
                  b = new BufferedOutputStream (new FileOutputStream(filename));
                  for (int i =0; i<outstr.length(); i++) {
                      b.write(outstr.charAt(i));
                  }
              } catch (IOException e) {
                  System.err.println("Exception");
                  System.exit(1);
              }
          }
      }


      $ javac T1.java
      $ java T1
      $ cat /tmp/b
      $

            mr Mark Reinhold
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: