public class FileWriterWithEncoding extends ProxyWriter
This class provides a simple alternative to FileWriter that allows an encoding to be set. Unfortunately, it cannot subclass FileWriter.
By default, the file will be overwritten, but this may be changed to append.
The encoding must be specified using either the name of the Charset, the Charset, or a CharsetEncoder. If the default encoding is
required then use the FileWriter directly, rather than this implementation.
To build an instance, use FileWriterWithEncoding.Builder.
FileWriterWithEncoding.Builder| Modifier and Type | Class and Description |
|---|---|
static class |
FileWriterWithEncoding.Builder
Builds a new
FileWriterWithEncoding. |
out| Modifier and Type | Method and Description |
|---|---|
static FileWriterWithEncoding.Builder |
builder()
Constructs a new
FileWriterWithEncoding.Builder. |
afterWrite, append, append, append, beforeWrite, close, flush, handleIOException, write, write, write, write, writepublic static FileWriterWithEncoding.Builder builder()
FileWriterWithEncoding.Builder.FileWriterWithEncoding.Builder.