Module java.base

Class FileWriter

All Implemented Interfaces:
Closeable, Flushable, Appendable, AutoCloseable

public class FileWriter extends OutputStreamWriter
Writes text to character files using a default buffer size. Encoding from characters to bytes uses either a specified charset or the default charset.

Whether or not a file is available or may be created depends upon the underlying platform. Some platforms, in particular, allow a file to be opened for writing by only one FileWriter (or other file-writing object) at a time. In such situations the constructors in this class will fail if the file involved is already open.

The FileWriter is meant for writing streams of characters. For writing streams of raw bytes, consider using a FileOutputStream.

See Also: