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.
Public Constructor Summary
|
|
|
FileWriter( File file, boolean append)
Creates a FileWriter using the File file .
|
|
|
|
FileWriter( String filename)
Creates a FileWriter using the platform dependent filename .
|
|
FileWriter( String filename, boolean append)
Creates a FileWriter using the platform dependent filename .
|
Inherited Method Summary
From class
java.io.OutputStreamWriter
void
|
close()
Closes this writer.
|
void
|
flush()
Flushes this writer.
|
String
|
getEncoding()
Returns the canonical name of the encoding used by this writer to convert characters to
bytes, or null if this writer has been closed.
|
void
|
write(int oneChar)
Writes the character oneChar to this writer.
|
void
|
write( String str, int offset, int count)
Writes count characters starting at offset in str
to this writer.
|
void
|
write(char[] buffer, int offset, int count)
Writes count characters starting at offset in buf
to this writer.
|
From class
java.io.Writer
Writer
|
append(char c)
Appends the specified character to this writer.
|
Writer
|
append( CharSequence csq, int start, int end)
Appends a subsequence of the specified character sequence to this writer.
|
Writer
|
|
abstract
void
|
close()
Closes the stream, flushing it first.
|
abstract
void
|
flush()
Flushes the stream.
|
void
|
|
void
|
write(int c)
Writes a single character.
|
void
|
write( String str, int off, int len)
Writes a portion of a string.
|
abstract
void
|
write(char[] cbuf, int off, int len)
Writes a portion of an array of characters.
|
void
|
write(char[] cbuf)
Writes an array of characters.
|
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this Object .
|
boolean
|
equals( Object obj)
Compares this instance with the specified object and indicates if they
are equal.
|
void
|
finalize()
Invoked when the garbage collector has detected that this instance is no longer reachable.
|
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(long timeout, 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 timeout)
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()
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object.
|
From interface
java.io.Closeable
abstract
void
|
close()
Closes this stream and releases any system resources associated
with it.
|
From interface
java.io.Flushable
abstract
void
|
flush()
Flushes this stream by writing any buffered output to the underlying
stream.
|
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. |