This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
FYI: Patch: java.io.PrintStream
- From: Michael Koch <konqueror at gmx dot de>
- To: java-patches at gcc dot gnu dot org
- Date: Tue, 27 May 2003 08:07:04 +0200
- Subject: FYI: Patch: java.io.PrintStream
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi list,
I commited the attached patch to trunk to merge java.io.PrintStream
even more with classpath's version.
Michael
- --
Homepage: http://www.worldforge.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
iD8DBQE+0wCIWSOgCCdjSDsRAnpGAJ99fic/lG3dVJNah4NgWLYE5f3XXQCdGiP4
BnUMrXgCuSMfePdbKKMfo1g=
=D1S7
-----END PGP SIGNATURE-----
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.1907
diff -u -b -B -r1.1907 ChangeLog
--- ChangeLog 26 May 2003 12:58:01 -0000 1.1907
+++ ChangeLog 27 May 2003 06:01:47 -0000
@@ -1,3 +1,10 @@
+2003-05-27 Michael Koch <konqueror@gmx.de>
+
+ * java/io/PrintStream.java
+ (PrintStream): Reformatted.
+ (PrintStream): New method, merged from classpath.
+ (write): Reformatted.
+
2003-05-26 Michael Koch <konqueror@gmx.de>
* java/net/NetPermission.java,
Index: java/io/PrintStream.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/io/PrintStream.java,v
retrieving revision 1.16
diff -u -b -B -r1.16 PrintStream.java
--- java/io/PrintStream.java 20 May 2003 11:53:11 -0000 1.16
+++ java/io/PrintStream.java 27 May 2003 06:01:47 -0000
@@ -104,7 +104,7 @@
*/
public PrintStream (OutputStream out)
{
- this(out, false);
+ this (out, false);
}
/**
@@ -123,13 +123,38 @@
*/
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,13 +528,14 @@
{
try
{
- out.write(oneByte);
+ out.write (oneByte);
+
if (auto_flush && oneByte == '\n')
- flush();
+ flush ();
}
catch (InterruptedIOException iioe)
{
- Thread.currentThread().interrupt();
+ Thread.currentThread ().interrupt ();
}
catch (IOException e)
{
@@ -532,11 +558,11 @@
out.write (buffer, offset, len);
if (auto_flush)
- flush();
+ flush ();
}
catch (InterruptedIOException iioe)
{
- Thread.currentThread().interrupt();
+ Thread.currentThread ().interrupt ();
}
catch (IOException e)
{