jdk/src/java.base/share/classes/java/io/FileWriter.java
changeset 32033 bf24e33c7919
parent 25859 3317bb8137f4
equal deleted inserted replaced
32032:22badc53802f 32033:bf24e33c7919
    32  * size are acceptable.  To specify these values yourself, construct an
    32  * size are acceptable.  To specify these values yourself, construct an
    33  * OutputStreamWriter on a FileOutputStream.
    33  * OutputStreamWriter on a FileOutputStream.
    34  *
    34  *
    35  * <p>Whether or not a file is available or may be created depends upon the
    35  * <p>Whether or not a file is available or may be created depends upon the
    36  * underlying platform.  Some platforms, in particular, allow a file to be
    36  * underlying platform.  Some platforms, in particular, allow a file to be
    37  * opened for writing by only one <tt>FileWriter</tt> (or other file-writing
    37  * opened for writing by only one {@code FileWriter} (or other file-writing
    38  * object) at a time.  In such situations the constructors in this class
    38  * object) at a time.  In such situations the constructors in this class
    39  * will fail if the file involved is already open.
    39  * will fail if the file involved is already open.
    40  *
    40  *
    41  * <p><code>FileWriter</code> is meant for writing streams of characters.
    41  * <p>{@code FileWriter} is meant for writing streams of characters.
    42  * For writing streams of raw bytes, consider using a
    42  * For writing streams of raw bytes, consider using a
    43  * <code>FileOutputStream</code>.
    43  * {@code FileOutputStream}.
    44  *
    44  *
    45  * @see OutputStreamWriter
    45  * @see OutputStreamWriter
    46  * @see FileOutputStream
    46  * @see FileOutputStream
    47  *
    47  *
    48  * @author      Mark Reinhold
    48  * @author      Mark Reinhold
    66     /**
    66     /**
    67      * Constructs a FileWriter object given a file name with a boolean
    67      * Constructs a FileWriter object given a file name with a boolean
    68      * indicating whether or not to append the data written.
    68      * indicating whether or not to append the data written.
    69      *
    69      *
    70      * @param fileName  String The system-dependent filename.
    70      * @param fileName  String The system-dependent filename.
    71      * @param append    boolean if <code>true</code>, then data will be written
    71      * @param append    boolean if {@code true}, then data will be written
    72      *                  to the end of the file rather than the beginning.
    72      *                  to the end of the file rather than the beginning.
    73      * @throws IOException  if the named file exists but is a directory rather
    73      * @throws IOException  if the named file exists but is a directory rather
    74      *                  than a regular file, does not exist but cannot be
    74      *                  than a regular file, does not exist but cannot be
    75      *                  created, or cannot be opened for any other reason
    75      *                  created, or cannot be opened for any other reason
    76      */
    76      */
    90         super(new FileOutputStream(file));
    90         super(new FileOutputStream(file));
    91     }
    91     }
    92 
    92 
    93     /**
    93     /**
    94      * Constructs a FileWriter object given a File object. If the second
    94      * Constructs a FileWriter object given a File object. If the second
    95      * argument is <code>true</code>, then bytes will be written to the end
    95      * argument is {@code true}, then bytes will be written to the end
    96      * of the file rather than the beginning.
    96      * of the file rather than the beginning.
    97      *
    97      *
    98      * @param file  a File object to write to
    98      * @param file  a File object to write to
    99      * @param     append    if <code>true</code>, then bytes will be written
    99      * @param     append    if {@code true}, then bytes will be written
   100      *                      to the end of the file rather than the beginning
   100      *                      to the end of the file rather than the beginning
   101      * @throws IOException  if the file exists but is a directory rather than
   101      * @throws IOException  if the file exists but is a directory rather than
   102      *                  a regular file, does not exist but cannot be created,
   102      *                  a regular file, does not exist but cannot be created,
   103      *                  or cannot be opened for any other reason
   103      *                  or cannot be opened for any other reason
   104      * @since 1.4
   104      * @since 1.4