aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/io/PrintStream.java
diff options
context:
space:
mode:
authorMichael Koch <konqueror@gmx.de>2003-05-27 06:04:28 +0000
committerMichael Koch <mkoch@gcc.gnu.org>2003-05-27 06:04:28 +0000
commitc414a2c3c919888e7a77e86b214a61de8c299824 (patch)
tree8839a60455bb5d6fb23680a5f64001b92b93778d /libjava/java/io/PrintStream.java
parent91adbcf7312f3c2ba14e68b111e1c2a58a30205a (diff)
downloadgcc-c414a2c3c919888e7a77e86b214a61de8c299824.zip
gcc-c414a2c3c919888e7a77e86b214a61de8c299824.tar.gz
gcc-c414a2c3c919888e7a77e86b214a61de8c299824.tar.bz2
2003-05-27 Michael Koch <konqueror@gmx.de>
* java/io/PrintStream.java (PrintStream): Reformatted. (PrintStream): New method, merged from classpath. (write): Reformatted. From-SVN: r67183
Diffstat (limited to 'libjava/java/io/PrintStream.java')
-rw-r--r--libjava/java/io/PrintStream.java50
1 files changed, 38 insertions, 12 deletions
diff --git a/libjava/java/io/PrintStream.java b/libjava/java/io/PrintStream.java
index 418eea1..ddc37ae 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,13 +123,38 @@ 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 <code>PrintStream</code> 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.
+ * <p>
+ * Note that this class is deprecated in favor of <code>PrintWriter</code>.
+ *
+ * @param out The <code>OutputStream</code> to write to.
+ * @param auto_flush <code>true</code> to flush the stream after every
+ * line, <code>false</code> 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
* <code>true</code> forever for this stream. Before checking for an
@@ -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 ();
}
}