diff options
author | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2006-12-10 20:25:39 +0000 |
---|---|---|
committer | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2006-12-10 20:25:39 +0000 |
commit | da66af5951b18b6f5e8752cbbe11f5f842332a33 (patch) | |
tree | a28e126d1415e3689be6c7b2c2d061ae51194195 /java/io/PrintStream.java | |
parent | ab90923ee693a17e2e0e37b6ba5a84794c9236de (diff) | |
download | classpath-da66af5951b18b6f5e8752cbbe11f5f842332a33.tar.gz |
2006-12-10 Andrew John Hughes <gnu_andrew@member.fsf.org>
* Merge of generics-branch to HEAD (woohoo!)
Diffstat (limited to 'java/io/PrintStream.java')
-rw-r--r-- | java/io/PrintStream.java | 54 |
1 files changed, 52 insertions, 2 deletions
diff --git a/java/io/PrintStream.java b/java/io/PrintStream.java index 2d31bbd1e..2d747c8c8 100644 --- a/java/io/PrintStream.java +++ b/java/io/PrintStream.java @@ -39,6 +39,9 @@ exception statement from your version. */ package java.io; +import java.util.Locale; +import java.util.Formatter; + import gnu.classpath.SystemProperties; /* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3 @@ -58,8 +61,9 @@ import gnu.classpath.SystemProperties; * * @author Aaron M. Renn (arenn@urbanophile.com) * @author Tom Tromey (tromey@cygnus.com) + * @author Andrew John Hughes (gnu_andrew@member.fsf.org) */ -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 @@ -620,5 +624,51 @@ public class PrintStream extends FilterOutputStream setError (); } } -} // class PrintStream + /** @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 |