From: Michael Koch Date: Tue, 27 May 2003 06:04:28 +0000 (+0000) Subject: 2003-05-27 Michael Koch X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c414a2c3c919888e7a77e86b214a61de8c299824;p=gcc.git 2003-05-27 Michael Koch * java/io/PrintStream.java (PrintStream): Reformatted. (PrintStream): New method, merged from classpath. (write): Reformatted. From-SVN: r67183 --- diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 1eb1992754c..a36a473dbf4 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,10 @@ +2003-05-27 Michael Koch + + * java/io/PrintStream.java + (PrintStream): Reformatted. + (PrintStream): New method, merged from classpath. + (write): Reformatted. + 2003-05-27 Michael Koch * java/lang/System.java: diff --git a/libjava/java/io/PrintStream.java b/libjava/java/io/PrintStream.java index 418eea178cd..ddc37aeb11e 100644 --- a/libjava/java/io/PrintStream.java +++ b/libjava/java/io/PrintStream.java @@ -104,7 +104,7 @@ public class PrintStream extends FilterOutputStream */ public PrintStream (OutputStream out) { - this(out, false); + this (out, false); } /** @@ -123,12 +123,37 @@ public class PrintStream extends FilterOutputStream */ public PrintStream (OutputStream out, boolean auto_flush) { - super(out); + super (out); converter = UnicodeToBytes.getDefaultEncoder(); this.auto_flush = auto_flush; } + /** + * This method intializes a new PrintStream object to write + * to the specified output sink. This constructor also allows "auto-flush" + * functionality to be specified where the stream will be flushed after + * every line is terminated or newline character is written. + *

+ * Note that this class is deprecated in favor of PrintWriter. + * + * @param out The OutputStream to write to. + * @param auto_flush true to flush the stream after every + * line, false otherwise + * @param encoding The name of the character encoding to use for this + * object. + * + * @deprecated + */ + public PrintStream (OutputStream out, boolean auto_flush, String encoding) + throws UnsupportedEncodingException + { + super (out); + + converter = UnicodeToBytes.getEncoder (encoding); + this.auto_flush = auto_flush; + } + /** * This method checks to see if an error has occurred on this stream. Note * that once an error has occurred, this method will continue to report @@ -503,17 +528,18 @@ public class PrintStream extends FilterOutputStream { try { - out.write(oneByte); - if (auto_flush && oneByte == '\n') - flush(); + out.write (oneByte); + + if (auto_flush && oneByte == '\n') + flush (); } catch (InterruptedIOException iioe) { - Thread.currentThread().interrupt(); + Thread.currentThread ().interrupt (); } catch (IOException e) { - setError (); + setError (); } } @@ -529,18 +555,18 @@ public class PrintStream extends FilterOutputStream { try { - out.write (buffer, offset, len); + out.write (buffer, offset, len); - if (auto_flush) - flush(); + if (auto_flush) + flush (); } catch (InterruptedIOException iioe) { - Thread.currentThread().interrupt(); + Thread.currentThread ().interrupt (); } catch (IOException e) { - setError (); + setError (); } }