diff options
author | Tom Tromey <tromey@gcc.gnu.org> | 2007-01-09 19:58:05 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2007-01-09 19:58:05 +0000 |
commit | 97b8365cafc3a344a22d3980b8ed885f5c6d8357 (patch) | |
tree | 996a5f57d4a68c53473382e45cb22f574cb3e4db /libjava/java/io/PrintStream.java | |
parent | c648dedbde727ca3f883bb5fd773aa4af70d3369 (diff) | |
download | gcc-97b8365cafc3a344a22d3980b8ed885f5c6d8357.zip gcc-97b8365cafc3a344a22d3980b8ed885f5c6d8357.tar.gz gcc-97b8365cafc3a344a22d3980b8ed885f5c6d8357.tar.bz2 |
Merged gcj-eclipse branch to trunk.
From-SVN: r120621
Diffstat (limited to 'libjava/java/io/PrintStream.java')
-rw-r--r-- | libjava/java/io/PrintStream.java | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/libjava/java/io/PrintStream.java b/libjava/java/io/PrintStream.java index dc26eda..d3f386d 100644 --- a/libjava/java/io/PrintStream.java +++ b/libjava/java/io/PrintStream.java @@ -38,6 +38,9 @@ exception statement from your version. */ package java.io; +import java.util.Formatter; +import java.util.Locale; + import gnu.gcj.convert.UnicodeToBytes; /* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3 @@ -58,7 +61,7 @@ import gnu.gcj.convert.UnicodeToBytes; * @author Aaron M. Renn (arenn@urbanophile.com) * @author Tom Tromey (tromey@cygnus.com) */ -public class PrintStream extends FilterOutputStream +public class PrintStream extends FilterOutputStream implements Appendable { /* Notice the implementation is quite similar to OutputStreamWriter. * This leads to some minor duplication, because neither inherits @@ -562,5 +565,52 @@ public class PrintStream extends FilterOutputStream setError (); } } + + /** @since 1.5 */ + public PrintStream append(char c) + { + print(c); + return this; + } + + /** @since 1.5 */ + public PrintStream append(CharSequence cs) + { + print(cs == null ? "null" : cs.toString()); + return this; + } + + /** @since 1.5 */ + public PrintStream append(CharSequence cs, int start, int end) + { + print(cs == null ? "null" : cs.subSequence(start, end).toString()); + return this; + } + + /** @since 1.5 */ + public PrintStream printf(String format, Object... args) + { + return format(format, args); + } + + /** @since 1.5 */ + public PrintStream printf(Locale locale, String format, Object... args) + { + return format(locale, format, args); + } + + /** @since 1.5 */ + public PrintStream format(String format, Object... args) + { + return format(Locale.getDefault(), format, args); + } + + /** @since 1.5 */ + public PrintStream format(Locale locale, String format, Object... args) + { + Formatter f = new Formatter(this, locale); + f.format(format, args); + return this; + } } // class PrintStream |