public static class FileWriterWithEncoding.Builder extends org.apache.commons.io.build.AbstractStreamBuilder<FileWriterWithEncoding,FileWriterWithEncoding.Builder>
FileWriterWithEncoding instance.
Using a CharsetEncoder:
FileWriterWithEncoding s = FileWriterWithEncoding.builder()
.setPath(path)
.setAppend(false)
.setCharsetEncoder(StandardCharsets.UTF_8.newEncoder())
.get();
Using a Charset:
FileWriterWithEncoding s = FileWriterWithEncoding.builder()
.setPath(path)
.setAppend(false)
.setCharsetEncoder(StandardCharsets.UTF_8)
.get();
| Constructor and Description |
|---|
Builder() |
| Modifier and Type | Method and Description |
|---|---|
FileWriterWithEncoding |
get()
Constructs a new instance.
|
FileWriterWithEncoding.Builder |
setAppend(boolean append)
Sets whether or not to append.
|
FileWriterWithEncoding.Builder |
setCharsetEncoder(java.nio.charset.CharsetEncoder charsetEncoder)
Sets charsetEncoder to use for encoding.
|
getCharset, setBufferSize, setBufferSize, setCharset, setCharset, setOpenOptionssetByteArray, setCharSequence, setFile, setFile, setInputStream, setOutputStream, setPath, setPath, setReader, setURI, setWriterequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitasSupplierpublic FileWriterWithEncoding get() throws java.io.IOException
This builder use the aspects File, CharsetEncoder, and append.
You must provide an origin that can be converted to a File by this builder, otherwise, this call will throw an
UnsupportedOperationException.
java.lang.UnsupportedOperationException - if the origin cannot provide a File.java.lang.IllegalStateException - if the origin is null.java.io.IOException - if an I/O error occurs.AbstractOrigin.getFile()public FileWriterWithEncoding.Builder setAppend(boolean append)
append - Whether or not to append.public FileWriterWithEncoding.Builder setCharsetEncoder(java.nio.charset.CharsetEncoder charsetEncoder)
charsetEncoder - The charsetEncoder to use for encoding.Copyright © 2010 - 2023 Adobe. All Rights Reserved