[PATCH] Add missing java.io.PrintStream constructors

View: New views
2 Messages — Rating Filter:   Alert me  

[PATCH] Add missing java.io.PrintStream constructors

by gnu_andrew :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Simple fix for http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40616 by
porting the constructors over from Classpath:

2009-07-27  Andrew John Hughes  <ahughes@...>

        * java/io/PrintStream.class: Regenerated.
        * java/io/PrintStream.h: Updated.
        * java/io/PrintStream.java:
        (PrintStream(File)): Ported from GNU Classpath
        version.
        (PrintStream(File, String)): Likewise.
        (PrintStream(String)): Likewise.
        (PrintStream(String, String)): Likewise.

Ok for trunk?
--
Andrew :-)

Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)

Support Free Java!
Contribute to GNU Classpath and the OpenJDK
http://www.gnu.org/software/classpath
http://openjdk.java.net

PGP Key: 94EFD9D8 (http://subkeys.pgp.net)
Fingerprint: F8EF F1EA 401E 2E60 15FA  7927 142C 2591 94EF D9D8

Index: libjava/classpath/tools/classes/gnu/classpath/tools/gjdoc/ConstructorDocImpl.class
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: libjava/classpath/lib/java/io/PrintStream.class
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: libjava/java/io/PrintStream.h
===================================================================
--- libjava/java/io/PrintStream.h (revision 150100)
+++ libjava/java/io/PrintStream.h (working copy)
@@ -27,6 +27,10 @@
 {
 
 public:
+  PrintStream(::java::io::File *);
+  PrintStream(::java::io::File *, ::java::lang::String *);
+  PrintStream(::java::lang::String *);
+  PrintStream(::java::lang::String *, ::java::lang::String *);
   PrintStream(::java::io::OutputStream *);
   PrintStream(::java::io::OutputStream *, jboolean);
   PrintStream(::java::io::OutputStream *, jboolean, ::java::lang::String *);
Index: libjava/java/io/PrintStream.java
===================================================================
--- libjava/java/io/PrintStream.java (revision 150100)
+++ libjava/java/io/PrintStream.java (working copy)
@@ -123,6 +123,74 @@
   }
 
   /**
+   * This method initializes a new <code>PrintStream</code> object to write
+   * to the specified output File. Doesn't autoflush.
+   *
+   * @param file The <code>File</code> to write to.
+   * @throws FileNotFoundException if an error occurs while opening the file.
+   *
+   * @since 1.5
+   */
+  public PrintStream (File file)
+    throws FileNotFoundException
+  {
+    this (new FileOutputStream(file), false);
+  }
+
+  /**
+   * This method initializes a new <code>PrintStream</code> object to write
+   * to the specified output File. Doesn't autoflush.
+   *
+   * @param file The <code>File</code> to write to.
+   * @param encoding The name of the character encoding to use for this
+   * object.
+   * @throws FileNotFoundException If an error occurs while opening the file.
+   * @throws UnsupportedEncodingException If the charset specified by
+   * <code>encoding</code> is invalid.
+   *
+   * @since 1.5
+   */
+  public PrintStream (File file, String encoding)
+    throws FileNotFoundException,UnsupportedEncodingException
+  {
+    this (new FileOutputStream(file), false, encoding);
+  }
+
+  /**
+   * This method initializes a new <code>PrintStream</code> object to write
+   * to the specified output File. Doesn't autoflush.
+   *
+   * @param fileName The name of the <code>File</code> to write to.
+   * @throws FileNotFoundException if an error occurs while opening the file,
+   *
+   * @since 1.5
+   */
+  public PrintStream (String fileName)
+    throws FileNotFoundException
+  {
+    this (new FileOutputStream(new File(fileName)), false);
+  }
+
+  /**
+   * This method initializes a new <code>PrintStream</code> object to write
+   * to the specified output File. Doesn't autoflush.
+   *
+   * @param fileName The name of the <code>File</code> to write to.
+   * @param encoding The name of the character encoding to use for this
+   * object.
+   * @throws FileNotFoundException if an error occurs while opening the file.
+   * @throws UnsupportedEncodingException If the charset specified by
+   * <code>encoding</code> is invalid.
+   *
+   * @since 1.5
+   */
+  public PrintStream (String fileName, String encoding)
+      throws FileNotFoundException,UnsupportedEncodingException
+  {
+    this (new FileOutputStream(new File(fileName)), false, encoding);
+  }
+
+  /**
    * 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

Re: [PATCH] Add missing java.io.PrintStream constructors

by Andrew Haley :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 07/28/2009 01:03 AM, Andrew John Hughes wrote:

> Simple fix for http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40616 by
> porting the constructors over from Classpath:
>
> 2009-07-27  Andrew John Hughes  <ahughes@...>
>
>         * java/io/PrintStream.class: Regenerated.
>         * java/io/PrintStream.h: Updated.
>         * java/io/PrintStream.java:
>         (PrintStream(File)): Ported from GNU Classpath
>         version.
>         (PrintStream(File, String)): Likewise.
>         (PrintStream(String)): Likewise.
>         (PrintStream(String, String)): Likewise.
>
> Ok for trunk?

Sure.

Andrew.