/[classpath]/classpath/java/io/PrintStream.java
ViewVC logotype

Diff of /classpath/java/io/PrintStream.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.19.2.2 by gnu_andrew, Fri Jan 7 03:42:30 2005 UTC revision 1.19.2.3 by gnu_andrew, Sat Jan 15 17:01:52 2005 UTC
# Line 1  Line 1 
1  /* PrintStream.java -- OutputStream for printing output  /* PrintStream.java -- OutputStream for printing output
2     Copyright (C) 1998, 1999, 2001, 2003, 2005 Free Software Foundation, Inc.     Copyright (C) 1998, 1999, 2001, 2003, 2004, 2005
3       Free Software Foundation, Inc.
4    
5  This file is part of GNU Classpath.  This file is part of GNU Classpath.
6    
# Line 82  public class PrintStream extends FilterO Line 83  public class PrintStream extends FilterO
83    private boolean closed;    private boolean closed;
84    
85    /**    /**
86       * This class exists to forward the write calls from the PrintWriter back
87       * to us. This is required to make subclassing of PrintStream work
88       * correctly.
89       */
90      private class ForwardStream extends OutputStream
91      {
92        public void close () throws IOException
93        {
94          out.close ();
95        }
96    
97        public void flush () throws IOException
98        {
99          out.flush ();
100        }
101    
102        public void write (byte[] b) throws IOException
103        {
104            PrintStream.this.write (b);
105        }
106    
107        public void write (byte[] b, int off, int len) throws IOException
108        {
109            PrintStream.this.write (b, off, len);
110        }
111    
112        public void write (int b) throws IOException
113        {
114            PrintStream.this.write (b);
115        }
116      }
117    
118      /**
119     * This method intializes a new <code>PrintStream</code> object to write     * This method intializes a new <code>PrintStream</code> object to write
120     * to the specified output sink.     * to the specified output sink.
121     *     *
# Line 109  public class PrintStream extends FilterO Line 143  public class PrintStream extends FilterO
143    {    {
144      super (out);      super (out);
145    
146      pw = new PrintWriter (out, auto_flush);      // FIXME Instead of using PrintWriter and ForwardStream we
147        // should inline the character conversion (see libgcj's version
148        // of this class)
149        pw = new PrintWriter (new ForwardStream (), auto_flush);
150      this.auto_flush = auto_flush;      this.auto_flush = auto_flush;
151    }    }
152    
# Line 133  public class PrintStream extends FilterO Line 170  public class PrintStream extends FilterO
170    {    {
171      super (out);      super (out);
172    
173      pw = new PrintWriter (new OutputStreamWriter (out, encoding), auto_flush);      // FIXME Instead of using PrintWriter and ForwardStream we
174        // should inline the character conversion (see libgcj's version
175        // of this class)
176        pw = new PrintWriter (
177                new OutputStreamWriter (
178                    new ForwardStream (), encoding), auto_flush);
179      this.auto_flush = auto_flush;      this.auto_flush = auto_flush;
180    }    }
181    
# Line 471  public class PrintStream extends FilterO Line 513  public class PrintStream extends FilterO
513          if (auto_flush && (oneByte == '\n'))          if (auto_flush && (oneByte == '\n'))
514            flush ();            flush ();
515        }        }
516        catch (InterruptedIOException iioe)
517          {
518            Thread.currentThread ().interrupt ();
519          }
520      catch (IOException e)      catch (IOException e)
521        {        {
522          setError ();          setError ();
# Line 498  public class PrintStream extends FilterO Line 544  public class PrintStream extends FilterO
544          if (auto_flush)          if (auto_flush)
545            flush ();            flush ();
546        }        }
547        catch (InterruptedIOException iioe)
548          {
549            Thread.currentThread ().interrupt ();
550          }
551      catch (IOException e)      catch (IOException e)
552        {        {
553          setError ();          setError ();

Legend:
Removed from v.1.19.2.2  
changed lines
  Added in v.1.19.2.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26