public final class FileReaderBuilder extends Object
FileReader objects.| Constructor and Description |
|---|
FileReaderBuilder() |
| Modifier and Type | Method and Description |
|---|---|
FileReaderBuilder |
allowNoFile()
If called and the file is
build() command will return an empty
reader instead of a FileNotFoundException. |
Reader |
build()
Creates a new File reader.
|
FileReaderBuilder |
charset(Charset cs)
Sets the character encoding of the file.
|
FileReaderBuilder |
charset(String cs)
Sets the character encoding of the file.
|
static FileReaderBuilder |
create()
Creates a new builder.
|
static FileReaderBuilder |
create(File file)
Creates a new builder initialized with the specified file.
|
FileReaderBuilder |
file(File file)
Sets the file being written from.
|
FileReaderBuilder |
file(String path)
Sets the path of the file being written from.
|
public FileReaderBuilder()
public static FileReaderBuilder create()
public static FileReaderBuilder create(File file)
file - The file being written to.public FileReaderBuilder file(File file)
file - The file being written from.public FileReaderBuilder file(String path)
path - The path of the file being written from.public FileReaderBuilder charset(Charset cs)
cs - The character encoding.
The default is Charset.defaultCharset().public FileReaderBuilder charset(String cs)
cs - The character encoding.
The default is Charset.defaultCharset().public FileReaderBuilder allowNoFile()
build() command will return an empty
reader instead of a FileNotFoundException.public Reader build() throws FileNotFoundException
FileNotFoundException - If file could not be found.Copyright © 2016–2019 The Apache Software Foundation. All rights reserved.