Package org.apache.commons.io.output
Class DeferredFileOutputStream.Builder
- java.lang.Object
-
- org.apache.commons.io.build.AbstractSupplier<T,B>
-
- org.apache.commons.io.build.AbstractOriginSupplier<T,B>
-
- org.apache.commons.io.build.AbstractStreamBuilder<DeferredFileOutputStream,DeferredFileOutputStream.Builder>
-
- org.apache.commons.io.output.DeferredFileOutputStream.Builder
-
- All Implemented Interfaces:
IOSupplier<DeferredFileOutputStream>
- Enclosing class:
- DeferredFileOutputStream
public static class DeferredFileOutputStream.Builder extends AbstractStreamBuilder<DeferredFileOutputStream,DeferredFileOutputStream.Builder>
Builds a newDeferredFileOutputStream.For example:
DeferredFileOutputStream s = DeferredFileOutputStream.builder() .setBufferSize(4096) .setDirectory(dir) .setOutputFile(outputFile) .setPrefix(prefix) .setSuffix(suffix) .setThreshold(threshold) .get();The only super's aspect used us buffer size.
- Since:
- 2.12.0
- See Also:
get()
-
-
Constructor Summary
Constructors Constructor Description Builder()Constructs a new builder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DeferredFileOutputStreamget()Builds a newDeferredFileOutputStream.DeferredFileOutputStream.BuildersetDirectory(java.io.File directory)Sets the temporary file directory.DeferredFileOutputStream.BuildersetDirectory(java.nio.file.Path directory)Sets the temporary file directory.DeferredFileOutputStream.BuildersetOutputFile(java.io.File outputFile)Sets the file to which data is saved beyond the threshold.DeferredFileOutputStream.BuildersetOutputFile(java.nio.file.Path outputFile)Sets the file to which data is saved beyond the threshold.DeferredFileOutputStream.BuildersetPrefix(java.lang.String prefix)Sets the prefix to use for the temporary file.DeferredFileOutputStream.BuildersetSuffix(java.lang.String suffix)Sets the suffix to use for the temporary file.DeferredFileOutputStream.BuildersetThreshold(int threshold)Sets the number of bytes at which to trigger an event.-
Methods inherited from class org.apache.commons.io.build.AbstractStreamBuilder
getCharset, setBufferSize, setBufferSize, setBufferSizeChecker, setBufferSizeMax, setCharset, setCharset, setOpenOptions
-
Methods inherited from class org.apache.commons.io.build.AbstractOriginSupplier
setByteArray, setCharSequence, setFile, setFile, setInputStream, setOutputStream, setPath, setPath, setReader, setURI, setWriter
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.commons.io.function.IOSupplier
asSupplier
-
-
-
-
Method Detail
-
get
public DeferredFileOutputStream get()
Builds a newDeferredFileOutputStream.This builder use the following aspects:
AbstractStreamBuilder.getBufferSize()- threshold
- outputFile
- prefix
- suffix
- directory
- Returns:
- a new instance.
-
setDirectory
public DeferredFileOutputStream.Builder setDirectory(java.io.File directory)
Sets the temporary file directory.- Parameters:
directory- Temporary file directory.- Returns:
- this
-
setDirectory
public DeferredFileOutputStream.Builder setDirectory(java.nio.file.Path directory)
Sets the temporary file directory.- Parameters:
directory- Temporary file directory.- Returns:
- this
- Since:
- 2.14.0
-
setOutputFile
public DeferredFileOutputStream.Builder setOutputFile(java.io.File outputFile)
Sets the file to which data is saved beyond the threshold.- Parameters:
outputFile- The file to which data is saved beyond the threshold.- Returns:
- this
-
setOutputFile
public DeferredFileOutputStream.Builder setOutputFile(java.nio.file.Path outputFile)
Sets the file to which data is saved beyond the threshold.- Parameters:
outputFile- The file to which data is saved beyond the threshold.- Returns:
- this
- Since:
- 2.14.0
-
setPrefix
public DeferredFileOutputStream.Builder setPrefix(java.lang.String prefix)
Sets the prefix to use for the temporary file.- Parameters:
prefix- Prefix to use for the temporary file.- Returns:
- this
-
setSuffix
public DeferredFileOutputStream.Builder setSuffix(java.lang.String suffix)
Sets the suffix to use for the temporary file.- Parameters:
suffix- Suffix to use for the temporary file.- Returns:
- this
-
setThreshold
public DeferredFileOutputStream.Builder setThreshold(int threshold)
Sets the number of bytes at which to trigger an event.- Parameters:
threshold- The number of bytes at which to trigger an event.- Returns:
- this
-
-