Class Overview
A specialized Writer
that writes to a file in the file system.
All write requests made by calling methods in this class are directly
forwarded to the equivalent function of the underlying operating system.
Since this may induce some performance penalty, in particular if many small
write requests are made, a FileWriter is often wrapped by a
BufferedWriter.
Summary
Public Constructors |
|
FileWriter(File file)
Creates a FileWriter using the File file .
|
|
FileWriter(File file, boolean append)
Creates a FileWriter using the File file .
|
|
FileWriter(FileDescriptor fd)
Creates a FileWriter using the existing FileDescriptor fd .
|
|
FileWriter(String filename)
Creates a FileWriter using the platform dependent filename .
|
|
FileWriter(String filename, boolean append)
Creates a FileWriter using the platform dependent filename .
|
[Expand]
Inherited Methods |
From class
java.io.OutputStreamWriter
void
|
close()
Closes this writer.
|
void
|
flush()
Flushes this writer.
|
String
|
getEncoding()
Gets the name of the encoding that is used to convert characters to
bytes.
|
void
|
write(char[] buffer, int offset, int count)
Writes count characters starting at offset in buf
to this writer.
|
void
|
write(String str, int offset, int count)
Writes count characters starting at offset in str
to this writer.
|
void
|
write(int oneChar)
Writes the character oneChar to this writer.
|
|
From class
java.io.Writer
Writer
|
append(CharSequence csq)
Appends the character sequence csq to the target.
|
Writer
|
append(CharSequence csq, int start, int end)
Appends a subsequence of the character sequence csq to the
target.
|
Writer
|
append(char c)
Appends the character c to the target.
|
abstract
void
|
close()
Closes this writer.
|
abstract
void
|
flush()
Flushes this writer.
|
void
|
write(char[] buf)
Writes the entire character buffer buf to the target.
|
void
|
write(String str)
Writes the characters from the specified string to the target.
|
abstract
void
|
write(char[] buf, int offset, int count)
Writes count characters starting at offset in buf
to the target.
|
void
|
write(String str, int offset, int count)
Writes count characters from str starting at offset to the target.
|
void
|
write(int oneChar)
Writes one character to the target.
|
|
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this Object .
|
boolean
|
equals(Object o)
Compares this instance with the specified object and indicates if they
are equal.
|
void
|
finalize()
Called before the object's memory is reclaimed by the VM.
|
final
Class<?>
|
getClass()
Returns the unique instance of Class that represents this
object's class.
|
int
|
hashCode()
Returns an integer hash code for this object.
|
final
void
|
notify()
Causes a thread which is waiting on this object's monitor (by means of
calling one of the wait() methods) to be woken up.
|
final
void
|
notifyAll()
Causes all threads which are waiting on this object's monitor (by means
of calling one of the wait() methods) to be woken up.
|
String
|
toString()
Returns a string containing a concise, human-readable description of this
object.
|
final
void
|
wait()
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object.
|
final
void
|
wait(long millis, int nanos)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
specified timeout expires.
|
final
void
|
wait(long millis)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
specified timeout expires.
|
|
From interface
java.io.Closeable
abstract
void
|
close()
Closes the object and release any system resources it holds.
|
|
From interface
java.io.Flushable
abstract
void
|
flush()
Flushes the object by writing out any buffered data to the underlying
output.
|
|
From interface
java.lang.Appendable
|
Public Constructors
public
FileWriter
(File file)
Creates a FileWriter using the File file
.
Parameters
file
| the non-null File to write bytes to. |
public
FileWriter
(File file, boolean append)
Creates a FileWriter using the File file
. The parameter
append
determines whether or not the file is opened and appended
to or just opened and overwritten.
Parameters
file
| the non-null File to write bytes to. |
append
| indicates whether or not to append to an existing file. |
Creates a FileWriter using the existing FileDescriptor fd
.
Parameters
fd
| the non-null FileDescriptor to write bytes to.
|
public
FileWriter
(String filename)
Creates a FileWriter using the platform dependent filename
.
Parameters
filename
| the non-null name of the file to write bytes to. |
public
FileWriter
(String filename, boolean append)
Creates a FileWriter using the platform dependent filename
. The
parameter append
determines whether or not the file is opened and
appended to or just opened and overwritten.
Parameters
filename
| the non-null name of the file to write bytes to. |
append
| indicates whether or not to append to an existing file. |