public final class FileWriterBuilder extends Object
FileWriter
objects.Constructor and Description |
---|
FileWriterBuilder() |
Modifier and Type | Method and Description |
---|---|
FileWriterBuilder |
append()
Sets the append mode on the writer to
|
Writer |
build()
Creates a new File writer.
|
FileWriterBuilder |
charset(Charset cs)
Sets the character encoding of the file.
|
FileWriterBuilder |
charset(String cs)
Sets the character encoding of the file.
|
static FileWriterBuilder |
create()
Creates a new builder.
|
static FileWriterBuilder |
create(File file)
Creates a new builder initialized with the specified file.
|
static FileWriterBuilder |
create(String path)
Creates a new builder initialized with the specified file path.
|
FileWriterBuilder |
file(File file)
Sets the file being written to.
|
FileWriterBuilder |
file(String path)
Sets the path of the file being written to.
|
public FileWriterBuilder()
public static FileWriterBuilder create()
public static FileWriterBuilder create(File file)
file
- The file being written to.public static FileWriterBuilder create(String path)
path
- The file path being written to.public FileWriterBuilder file(File file)
file
- The file being written to.public FileWriterBuilder file(String path)
path
- The path of the file being written to.public FileWriterBuilder charset(Charset cs)
cs
- The character encoding.
The default is Charset.defaultCharset()
.public FileWriterBuilder charset(String cs)
cs
- The character encoding.
The default is Charset.defaultCharset()
.public FileWriterBuilder append()
public Writer build() throws FileNotFoundException
FileNotFoundException
- If file could not be found.Copyright © 2016–2020 The Apache Software Foundation. All rights reserved.