public class FileWriter extends OutputStreamWriter
| Constructor and Description |
|---|
FileWriter(FileDescriptor fd,
String charset)
Constructs a FileWriter object associated with a file descriptor.
|
FileWriter(File file,
String charset)
Constructs a FileWriter object given a File object.
|
FileWriter(File file,
String charset,
boolean append)
Constructs a FileWriter object given a File object.
|
FileWriter(String filename,
String charset)
Constructs a FileWriter object given a file name.
|
FileWriter(String filename,
String charset,
boolean append)
Constructs a FileWriter object given a file name with a boolean
indicating whether or not to append the data written.
|
close, flush, getEncoding, write, write, writepublic FileWriter(String filename, String charset) throws IOException
filename - String The system-dependent filename.charset - the charset to decode the file, such as UTF-8.
If null, UTF-8 is assumed.IOException - if the named file exists but is a directory
rather than a regular file, does not exist but cannot be created,
or cannot be opened for any other reasonpublic FileWriter(String filename, String charset, boolean append) throws IOException
filename - String The system-dependent filename.charset - the charset to decode the file, such as UTF-8.
If null, UTF-8 is assumed.append - boolean if true, then data will be written
to the end of the file rather than the beginning.IOException - if the named file exists but is a directory
rather than a regular file, does not exist but cannot be created,
or cannot be opened for any other reasonpublic FileWriter(File file, String charset) throws IOException
file - a File object to write to.charset - the charset to decode the file, such as UTF-8.
If null, UTF-8 is assumed.IOException - if the named file exists but is a directory
rather than a regular file, does not exist but cannot be created,
or cannot be opened for any other reasonpublic FileWriter(File file, String charset, boolean append) throws IOException
file - a File object to write tocharset - the charset to decode the file, such as UTF-8.
If null, UTF-8 is assumed.append - if true, then bytes will be written
to the end of the file rather than the beginningIOException - if the named file exists but is a directory
rather than a regular file, does not exist but cannot be created,
or cannot be opened for any other reasonpublic FileWriter(FileDescriptor fd, String charset) throws IOException
fd - FileDescriptor object to write to.charset - the charset to decode the file, such as UTF-8.
If null, UTF-8 is assumed.IOExceptionCopyright © 2018. All rights reserved.