java.io

Class FileWriter

public class FileWriter extends OutputStreamWriter

This is a convenience class for writing to files. It creates an FileOutputStream and initializes an OutputStreamWriter to write to it.
Constructor Summary
FileWriter(File file)
This method initializes a new FileWriter object to write to the specified File object.
FileWriter(File file, boolean append)
This method initializes a new FileWriter object to write to the specified File object.
FileWriter(FileDescriptor fd)
This method initializes a new FileWriter object to write to the specified FileDescriptor object.
FileWriter(String name)
This method intializes a new FileWriter object to write to the specified named file.
FileWriter(String name, boolean append)
This method intializes a new FileWriter object to write to the specified named file.

Constructor Detail

FileWriter

public FileWriter(File file)
This method initializes a new FileWriter object to write to the specified File object.

Parameters: file The File object to write to.

Throws: SecurityException If writing to this file is forbidden by the SecurityManager. IOException If any other error occurs

FileWriter

public FileWriter(File file, boolean append)
This method initializes a new FileWriter object to write to the specified File object.

Parameters: file The File object to write to. append true to start adding data at the end of the file, false otherwise.

Throws: SecurityException If writing to this file is forbidden by the SecurityManager. IOException If any other error occurs

FileWriter

public FileWriter(FileDescriptor fd)
This method initializes a new FileWriter object to write to the specified FileDescriptor object.

Parameters: fd The FileDescriptor object to write to

Throws: SecurityException If writing to this file is forbidden by the SecurityManager.

FileWriter

public FileWriter(String name)
This method intializes a new FileWriter object to write to the specified named file.

Parameters: name The name of the file to write to

Throws: SecurityException If writing to this file is forbidden by the SecurityManager. IOException If any other error occurs

FileWriter

public FileWriter(String name, boolean append)
This method intializes a new FileWriter object to write to the specified named file. This form of the constructor allows the caller to determine whether data should be written starting at the beginning or the end of the file.

Parameters: name The name of the file to write to append true to start adding data at the end of the file, false otherwise.

Throws: SecurityException If writing to this file is forbidden by the SecurityManager. IOException If any other error occurs