public static class LockableFileWriter.Builder extends 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(File lockDirectory)
Sets the directory in which the lock file should be held.
|
LockableFileWriter.Builder |
setLockDirectory(String lockDirectory)
Sets the directory in which the lock file should be held.
|
getBufferSize, getBufferSizeDefault, getCharSequence, getCharset, getCharsetDefault, getInputStream, getOpenOptions, getOutputStream, getPath, getWriter, setBufferSize, setBufferSize, setBufferSizeDefault, setCharset, setCharset, setCharsetDefault, setOpenOptions
checkOrigin, getOrigin, hasOrigin, newByteArrayOrigin, newCharSequenceOrigin, newFileOrigin, newFileOrigin, newInputStreamOrigin, newOutputStreamOrigin, newPathOrigin, newPathOrigin, newReaderOrigin, newURIOrigin, newWriterOrigin, setByteArray, setCharSequence, setFile, setFile, setInputStream, setOrigin, setOutputStream, setPath, setPath, setReader, setURI, setWriter
asThis
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
asSupplier
public Builder()
public LockableFileWriter get() throws 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
.
UnsupportedOperationException
- if the origin cannot provide a File.IllegalStateException
- if the origin
is null
.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(File lockDirectory)
lockDirectory
- the directory in which the lock file should be held.public LockableFileWriter.Builder setLockDirectory(String lockDirectory)
lockDirectory
- the directory in which the lock file should be held.Copyright © 2002–2023 The Apache Software Foundation. All rights reserved.