[kaffe] CVS kaffe (robilad): Resynced with GNU Classpath: fixes for PrintStream

Kaffe CVS cvs-commits at kaffe.org
Mon Oct 11 18:15:43 PDT 2004


PatchSet 5274 
Date: 2004/10/12 01:11:42
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath: fixes for PrintStream

2004-10-11  Dalibor Topic <robilad at kaffe.org>

        * libraries/javalib/java/io/PrintStream.java:
        Resynced with GNU Classpath.

        2004-10-11  Jeroen Frijters  <jeroen at frijters.net>

        * java/io/PrintStream.java
        (ForwardStream): New inner class.
        (PrintStream(OutputStream,boolean),
        PrintStream(OutputStream,boolean,String)):
        Changed to use ForwardStream.
        (write(int), write(byte[],int,int)):
        Don't consume thread interrupts.

Members: 
	ChangeLog:1.2826->1.2827 
	libraries/javalib/java/io/PrintStream.java:1.15->1.16 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2826 kaffe/ChangeLog:1.2827
--- kaffe/ChangeLog:1.2826	Tue Oct 12 01:00:34 2004
+++ kaffe/ChangeLog	Tue Oct 12 01:11:42 2004
@@ -1,5 +1,20 @@
 2004-10-11  Dalibor Topic <robilad at kaffe.org>
 
+	* libraries/javalib/java/io/PrintStream.java:
+	Resynced with GNU Classpath.
+
+	2004-10-11  Jeroen Frijters  <jeroen at frijters.net>
+
+        * java/io/PrintStream.java
+        (ForwardStream): New inner class.
+        (PrintStream(OutputStream,boolean),
+        PrintStream(OutputStream,boolean,String)):
+        Changed to use ForwardStream.
+        (write(int), write(byte[],int,int)):
+        Don't consume thread interrupts.
+
+2004-10-11  Dalibor Topic <robilad at kaffe.org>
+
 	* libraries/javalib/java/util/logging/LogManager.java:
         Resynced with GNU Classpath.
 
Index: kaffe/libraries/javalib/java/io/PrintStream.java
diff -u kaffe/libraries/javalib/java/io/PrintStream.java:1.15 kaffe/libraries/javalib/java/io/PrintStream.java:1.16
--- kaffe/libraries/javalib/java/io/PrintStream.java:1.15	Sun Nov  2 13:29:37 2003
+++ kaffe/libraries/javalib/java/io/PrintStream.java	Tue Oct 12 01:11:43 2004
@@ -1,5 +1,5 @@
 /* PrintStream.java -- OutputStream for printing output
-   Copyright (C) 1998, 1999, 2001, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2001, 2003, 2004 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -81,6 +81,39 @@
   private boolean closed;
 
   /**
+   * This class exists to forward the write calls from the PrintWriter back
+   * to us. This is required to make subclassing of PrintStream work
+   * correctly.
+   */
+  private class ForwardStream extends OutputStream
+  {
+    public void close () throws IOException
+    {
+      out.close ();
+    }
+
+    public void flush () throws IOException
+    {
+      out.flush ();
+    }
+
+    public void write (byte[] b) throws IOException
+    {
+	PrintStream.this.write (b);
+    }
+
+    public void write (byte[] b, int off, int len) throws IOException
+    {
+	PrintStream.this.write (b, off, len);
+    }
+
+    public void write (int b) throws IOException
+    {
+	PrintStream.this.write (b);
+    }
+  }
+
+  /**
    * This method intializes a new <code>PrintStream</code> object to write
    * to the specified output sink.
    *
@@ -108,7 +141,10 @@
   {
     super (out);
 
-    pw = new PrintWriter (out, auto_flush);
+    // FIXME Instead of using PrintWriter and ForwardStream we
+    // should inline the character conversion (see libgcj's version
+    // of this class)
+    pw = new PrintWriter (new ForwardStream (), auto_flush);
     this.auto_flush = auto_flush;
   }
 
@@ -132,7 +168,12 @@
   {
     super (out);
 
-    pw = new PrintWriter (new OutputStreamWriter (out, encoding), auto_flush);
+    // FIXME Instead of using PrintWriter and ForwardStream we
+    // should inline the character conversion (see libgcj's version
+    // of this class)
+    pw = new PrintWriter (
+	    new OutputStreamWriter (
+		new ForwardStream (), encoding), auto_flush);
     this.auto_flush = auto_flush;
   }
 
@@ -435,6 +476,10 @@
         if (auto_flush && (oneByte == '\n'))
           flush ();
       }
+    catch (InterruptedIOException iioe)
+      {
+	Thread.currentThread ().interrupt ();
+      }
     catch (IOException e)
       {
         setError ();
@@ -462,10 +507,13 @@
         if (auto_flush)
           flush ();
       }
+    catch (InterruptedIOException iioe)
+      {
+	Thread.currentThread ().interrupt ();
+      }
     catch (IOException e)
       {
         setError ();
       }
   }
 } // class PrintStream
-




More information about the kaffe mailing list