public static class LockableFileWriter.Builder extends org.apache.commons.io.build.AbstractStreamBuilder<LockableFileWriter,LockableFileWriter.Builder>
LockableFileWriter
instance.
Using a CharsetEncoder:
LockableFileWriter w = LockableFileWriter.builder()
.setPath(path)
.setAppend(false)
.setLockDirectory("Some/Directory")
.get();
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
LockableFileWriter |
get()
Constructs a new instance.
|
LockableFileWriter.Builder |
setAppend(boolean append)
Sets whether to append (true) or overwrite (false).
|
LockableFileWriter.Builder |
setLockDirectory(java.io.File lockDirectory)
Sets the directory in which the lock file should be held.
|
LockableFileWriter.Builder |
setLockDirectory(java.lang.String lockDirectory)
Sets the directory in which the lock file should be held.
|
getCharset, setBufferSize, setBufferSize, setCharset, setCharset, setOpenOptions
setByteArray, setCharSequence, setFile, setFile, setInputStream, setOutputStream, setPath, setPath, setReader, setURI, setWriter
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
asSupplier
public LockableFileWriter get() throws java.io.IOException
This builder use the aspects File, Charset, append, and lockDirectory.
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 LockableFileWriter.Builder setAppend(boolean append)
append
- whether to append (true) or overwrite (false).public LockableFileWriter.Builder setLockDirectory(java.io.File lockDirectory)
lockDirectory
- the directory in which the lock file should be held.public LockableFileWriter.Builder setLockDirectory(java.lang.String lockDirectory)
lockDirectory
- the directory in which the lock file should be held.Copyright © 2010 - 2023 Adobe. All Rights Reserved