BufferedOutputStream.java (write(int)): Only flush when next byte cannot be buffered.
authorMark Wielaard <mark@klomp.org>
Thu, 13 Feb 2003 22:48:36 +0000 (22:48 +0000)
committerMark Wielaard <mark@gcc.gnu.org>
Thu, 13 Feb 2003 22:48:36 +0000 (22:48 +0000)
       * java/io/BufferedOutputStream.java (write(int)): Only flush when
       next byte cannot be buffered.

From-SVN: r62867

libjava/ChangeLog
libjava/java/io/BufferedOutputStream.java

index 3f8448c1627325840bdaa9013189b9480607cc2d..d6f977f8dd905431559f1d364710b67786edfc09 100644 (file)
@@ -1,3 +1,8 @@
+2003-02-13  Mark Wielaard  <mark@klomp.org>
+
+       * java/io/BufferedOutputStream.java (write(int)): Only flush when
+       next byte cannot be buffered.
+
 2003-02-13  Michael Koch  <konqueror@gmx.de>
  
        * java/awt/Label.java
index 2cbdd4a16879a63ba2c5d1b6dd83ba0b13c1eb1e..e324cbcf938fe1623c37555e4b5e7ea694fe56f3 100644 (file)
@@ -1,5 +1,5 @@
 /* BufferedOutputStream.java -- Buffer output into large blocks before writing
-   Copyright (C) 1998, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2000, 2003 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -189,11 +189,11 @@ finalize() throws IOException
 public synchronized void
 write(int b) throws IOException
 {
-  buf[count] = (byte)(b & 0xFF);
-
-  ++count;
   if (count == buf.length)
     flush();
+
+  buf[count] = (byte)(b & 0xFF);
+  ++count;
 }
 
 /*************************************************************************/