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 new `DeferredFileOutputStream` instance.

  For example:

       DeferredFileOutputStream s = DeferredFileOutputStream.builder()
         .setPath(path)
         .setBufferSize(4096)
         .setDirectory(dir)
         .setOutputFile(outputFile)
         .setPrefix(prefix)
         .setSuffix(suffix)
         .setThreshold(threshold)
         .get();

  Since:
    2.12.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Builder()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `DeferredFileOutputStream` | `get()` Constructs a new instance.
    `DeferredFileOutputStream.Builder` | `setDirectory(File directory)` Sets the temporary file directory.
    `DeferredFileOutputStream.Builder` | `setOutputFile(File outputFile)` Sets the file to which data is saved beyond the threshold.
    `DeferredFileOutputStream.Builder` | `setPrefix(String prefix)` Sets the prefix to use for the temporary file.
    `DeferredFileOutputStream.Builder` | `setSuffix(String suffix)` Sets the suffix to use for the temporary file.
    `DeferredFileOutputStream.Builder` | `setThreshold(int threshold)` Sets the number of bytes at which to trigger an event.

    - ### Methods inherited from class org.apache.commons.io.build.AbstractStreamBuilder

      `getBufferSize, getBufferSizeDefault, getCharSequence, getCharset, getCharsetDefault, getInputStream, getOpenOptions, getOutputStream, getPath, getWriter, setBufferSize, setBufferSize, setBufferSizeDefault, setCharset, setCharset, setCharsetDefault, setOpenOptions`

    - ### Methods inherited from class org.apache.commons.io.build.AbstractOriginSupplier

      `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`

    - ### Methods inherited from class org.apache.commons.io.build.AbstractSupplier

      `asThis`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.apache.commons.io.function.IOSupplier

      `asSupplier`

- - ### Constructor Detail

    - #### Builder

          public Builder()

  - ### Method Detail

    - #### get

          public DeferredFileOutputStream get()

      Constructs a new instance.

      This builder use the aspects threshold, outputFile, prefix, suffix, directory, buffer size.

      Returns:
        a new instance.

    - #### setDirectory

          public DeferredFileOutputStream.Builder setDirectory(File directory)

      Sets the temporary file directory.
      Parameters:
        `directory` - Temporary file directory.
      Returns:
        this

    - #### setOutputFile

          public DeferredFileOutputStream.Builder setOutputFile(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

    - #### setPrefix

          public DeferredFileOutputStream.Builder setPrefix(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(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

Copyright © 2002–2023 The Apache Software Foundation. All rights reserved.