2003-03-19 Michael Koch <konqueror@gmx.de>
authorMichael Koch <konqueror@gmx.de>
Wed, 19 Mar 2003 12:13:41 +0000 (12:13 +0000)
committerMichael Koch <mkoch@gcc.gnu.org>
Wed, 19 Mar 2003 12:13:41 +0000 (12:13 +0000)
* java/io/FileOutputStream.java
(FileOutputStream): New constructor, merged from classpath.
* java/io/FileWriter.java
(FileWriter): New constructor, merged from classpath.

From-SVN: r64574

libjava/ChangeLog
libjava/java/io/FileOutputStream.java
libjava/java/io/FileWriter.java

index ab1c75b3e9c5a5764705f4f9e3b042d62b8c6d63..5d2d04776717a6070ed0d4593ecc4da87b3aa732 100644 (file)
@@ -1,3 +1,10 @@
+2003-03-19  Michael Koch  <konqueror@gmx.de>
+
+       * java/io/FileOutputStream.java
+       (FileOutputStream): New constructor, merged from classpath.
+       * java/io/FileWriter.java
+       (FileWriter): New constructor, merged from classpath.
+
 2003-03-18  Michael Koch  <konqueror@gmx.de>
 
        * java/awt/ScrollPane.java
index 5ea24e5dfcf082286299162cb883ac17817b5a19..eee3449576ec6cadfc0abfb7378c9347db865347 100644 (file)
@@ -47,6 +47,32 @@ public class FileOutputStream extends OutputStream
     this (file.getPath(), false);
   }
 
+  /**
+   * This method initializes a <code>FileOutputStream</code> object to write
+   * to the specified <code>File</code> object.  The file is created if it 
+   * does not exist, and the bytes written are written starting at the 
+   * beginning of the file if the <code>append</code> parameter is 
+   * <code>false</code>.  Otherwise bytes are written at the end of the
+   * file.
+   * <p>
+   * Before opening a file, a security check is performed by calling the
+   * <code>checkWrite</code> method of the <code>SecurityManager</code> (if
+   * one exists) with the name of the file to be opened.  An exception is
+   * thrown if writing is not allowed. 
+   *
+   * @param file The <code>File</code> object this stream should write to
+   * @param append <code>true</code> to append bytes to the end of the file,
+   * or <code>false</code> to write bytes to the beginning
+   *
+   * @exception SecurityException If write access to the file is not allowed
+   * @exception FileNotFoundException If a non-security error occurs
+   */
+  public
+  FileOutputStream(File file, boolean append) throws FileNotFoundException
+  {
+    this(file.getPath(), append);
+  }
+
   public FileOutputStream (FileDescriptor fdObj)
     throws SecurityException
   {
index 5217f9ecc33432a812a505a7dd1c271705059910..b7f8579f22f1ea38075f992c6d15045a29b61779 100644 (file)
@@ -1,5 +1,5 @@
 /* FileWriter.java -- Convenience class for writing to files.
-   Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2001, 2003 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -77,6 +77,25 @@ public class FileWriter extends OutputStreamWriter
 
   /*************************************************************************/
 
+  /**
+    * This method initializes a new <code>FileWriter</code> object to write
+    * to the specified <code>File</code> object.
+    *
+    * @param file The <code>File</code> object to write to.
+    * @param append <code>true</code> to start adding data at the end of the
+    *               file, <code>false</code> otherwise.
+    *
+    * @param SecurityException If writing to this file is forbidden by the
+    *                          <code>SecurityManager</code>.
+    * @param IOException If any other error occurs
+    */
+  public FileWriter(File file, boolean append) throws IOException
+  {
+    super(new FileOutputStream(file, append));
+  }
+
+  /*************************************************************************/
+
   /**
     * This method initializes a new <code>FileWriter</code> object to write
     * to the specified <code>FileDescriptor</code> object.