diff options
author | Tom Tromey <tromey@redhat.com> | 2005-04-20 20:27:38 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2005-04-20 20:27:38 +0000 |
commit | 3691e66f37b5a3ae92e32b1a2219fc33cca54571 (patch) | |
tree | 50ae0fdf846c20a9f9fc1f09c29f559d815e7f33 /java/io/PrintWriter.java | |
parent | 23163d962910ac29d241bc95d54054aa4f8e6cd0 (diff) | |
download | classpath-3691e66f37b5a3ae92e32b1a2219fc33cca54571.tar.gz |
* java/io/PrintStream.java (append): Don't throw IOException.
* java/io/StringWriter.java (append): New overloads.
* java/io/PrintWriter.java (append): New overloads.
(PrintWriter): New constructors.
* java/io/CharArrayWriter.java (append): New overloads.
* java/io/RandomAccessFile.java (RandomAccessFile): Implements
Closeable.
* java/io/Reader.java (Reader): Implements Readable.
(read): New method.
Diffstat (limited to 'java/io/PrintWriter.java')
-rw-r--r-- | java/io/PrintWriter.java | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/java/io/PrintWriter.java b/java/io/PrintWriter.java index e03f2f85a..bdb1090bd 100644 --- a/java/io/PrintWriter.java +++ b/java/io/PrintWriter.java @@ -1,5 +1,5 @@ /* PrintWriter.java -- prints primitive values and objects to a stream as text - Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation + Copyright (C) 1998, 1999, 2000, 2001, 2005 Free Software Foundation This file is part of GNU Classpath. @@ -138,6 +138,34 @@ public class PrintWriter extends Writer this.autoflush = autoflush; } + /** @since 1.5 */ + public PrintWriter(String path) + throws FileNotFoundException + { + this(new OutputStreamWriter(new FileOutputStream(path))); + } + + /** @since 1.5 */ + public PrintWriter(String path, String encoding) + throws FileNotFoundException, UnsupportedEncodingException + { + this(new OutputStreamWriter(new FileOutputStream(path), encoding)); + } + + /** @since 1.5 */ + public PrintWriter(File path) + throws FileNotFoundException + { + this(new OutputStreamWriter(new FileOutputStream(path))); + } + + /** @since 1.5 */ + public PrintWriter(File path, String encoding) + throws FileNotFoundException, UnsupportedEncodingException + { + this(new OutputStreamWriter(new FileOutputStream(path), encoding)); + } + /** * This method can be called by subclasses to indicate that an error * has occurred and should be reported by <code>checkError</code>. @@ -567,5 +595,26 @@ public class PrintWriter extends Writer { write(str, 0, str.length()); } + + /** @since 1.5 */ + public PrintWriter append(char c) + { + write(c); + return this; + } + + /** @since 1.5 */ + public PrintWriter append(CharSequence cs) + { + write(cs == null ? "null" : cs.toString()); + return this; + } + + /** @since 1.5 */ + public PrintWriter append(CharSequence cs, int start, int end) + { + write(cs == null ? "null" : cs.subSequence(start, end).toString()); + return this; + } } |