[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cp-patches] Patch: FYI: 1.5 PrintWriter constructors
From: |
Tom Tromey |
Subject: |
[cp-patches] Patch: FYI: 1.5 PrintWriter constructors |
Date: |
16 Sep 2005 13:43:05 -0600 |
I'm checking this in (on the trunk).
This adds the new 1.5 PrintWriter constructors.
Tom
Index: ChangeLog
from Tom Tromey <address@hidden>
* java/io/PrintWriter.java (PrintWriter): New constructors.
Index: java/io/PrintWriter.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/io/PrintWriter.java,v
retrieving revision 1.18
diff -u -r1.18 PrintWriter.java
--- java/io/PrintWriter.java 16 Sep 2005 19:23:38 -0000 1.18
+++ java/io/PrintWriter.java 16 Sep 2005 19:44:59 -0000
@@ -144,6 +144,68 @@
}
/**
+ * This initializes a new PrintWriter object to write to the specified
+ * file. It creates a FileOutputStream object and wraps it in an
+ * OutputStreamWriter using the default encoding.
+ * @param file name of the file to write to
+ * @throws FileNotFoundException if the file cannot be written or created
+ *
+ * @since 1.5
+ */
+ public PrintWriter(String file) throws FileNotFoundException
+ {
+ this(new FileOutputStream(file));
+ }
+
+ /**
+ * This initializes a new PrintWriter object to write to the specified
+ * file. It creates a FileOutputStream object and wraps it in an
+ * OutputStreamWriter using the specified encoding.
+ * @param file name of the file to write to
+ * @param enc the encoding to use
+ * @throws FileNotFoundException if the file cannot be written or created
+ * @throws UnsupportedEncodingException if the encoding is not supported
+ *
+ * @since 1.5
+ */
+ public PrintWriter(String file, String enc)
+ throws FileNotFoundException, UnsupportedEncodingException
+ {
+ this(new OutputStreamWriter(new FileOutputStream(file), enc));
+ }
+
+ /**
+ * This initializes a new PrintWriter object to write to the specified
+ * file. It creates a FileOutputStream object and wraps it in an
+ * OutputStreamWriter using the default encoding.
+ * @param file the file to write to
+ * @throws FileNotFoundException if the file cannot be written or created
+ *
+ * @since 1.5
+ */
+ public PrintWriter(File file) throws FileNotFoundException
+ {
+ this(new FileOutputStream(file));
+ }
+
+ /**
+ * This initializes a new PrintWriter object to write to the specified
+ * file. It creates a FileOutputStream object and wraps it in an
+ * OutputStreamWriter using the specified encoding.
+ * @param file the file to write to
+ * @param enc the encoding to use
+ * @throws FileNotFoundException if the file cannot be written or created
+ * @throws UnsupportedEncodingException if the encoding is not supported
+ *
+ * @since 1.5
+ */
+ public PrintWriter(File file, String enc)
+ throws FileNotFoundException, UnsupportedEncodingException
+ {
+ this(new OutputStreamWriter(new FileOutputStream(file), enc));
+ }
+
+ /**
* This method can be called by subclasses to indicate that an error
* has occurred and should be reported by <code>checkError</code>.
*/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [cp-patches] Patch: FYI: 1.5 PrintWriter constructors,
Tom Tromey <=