diff options
Diffstat (limited to 'src/main/java/org/apache/commons/io/output/DeferredFileOutputStream.java')
-rw-r--r-- | src/main/java/org/apache/commons/io/output/DeferredFileOutputStream.java | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/src/main/java/org/apache/commons/io/output/DeferredFileOutputStream.java b/src/main/java/org/apache/commons/io/output/DeferredFileOutputStream.java index d4dc19e9..3382bdcd 100644 --- a/src/main/java/org/apache/commons/io/output/DeferredFileOutputStream.java +++ b/src/main/java/org/apache/commons/io/output/DeferredFileOutputStream.java @@ -70,6 +70,9 @@ public class DeferredFileOutputStream extends ThresholdingOutputStream { private String suffix; private Path directory; + /** + * Constructs a new builder. + */ public Builder() { setBufferSizeDefault(AbstractByteArrayOutputStream.DEFAULT_SIZE); setBufferSize(AbstractByteArrayOutputStream.DEFAULT_SIZE); @@ -265,28 +268,6 @@ public class DeferredFileOutputStream extends ThresholdingOutputStream { } /** - * Constructs an instance of this class which will trigger an event at the specified threshold, and save data either to a file beyond that point. - * - * @param threshold The number of bytes at which to trigger an event. - * @param outputFile The file to which data is saved beyond the threshold. - * @param prefix Prefix to use for the temporary file. - * @param suffix Suffix to use for the temporary file. - * @param directory Temporary file directory. - * @param initialBufferSize The initial size of the in memory buffer. - * @throws IllegalArgumentException if initialBufferSize < 0. - */ - private DeferredFileOutputStream(final int threshold, final Path outputFile, final String prefix, final String suffix, final Path directory, - final int initialBufferSize) { - super(threshold); - this.outputPath = toPath(outputFile, null); - this.prefix = prefix; - this.suffix = suffix; - this.directory = toPath(directory, PathUtils::getTempDirectory); - this.memoryOutputStream = new ByteArrayOutputStream(checkBufferSize(initialBufferSize)); - this.currentOutputStream = memoryOutputStream; - } - - /** * Constructs an instance of this class which will trigger an event at the specified threshold, and save data to a file beyond that point. * * @param threshold The number of bytes at which to trigger an event. @@ -317,6 +298,28 @@ public class DeferredFileOutputStream extends ThresholdingOutputStream { } /** + * Constructs an instance of this class which will trigger an event at the specified threshold, and save data either to a file beyond that point. + * + * @param threshold The number of bytes at which to trigger an event. + * @param outputFile The file to which data is saved beyond the threshold. + * @param prefix Prefix to use for the temporary file. + * @param suffix Suffix to use for the temporary file. + * @param directory Temporary file directory. + * @param initialBufferSize The initial size of the in memory buffer. + * @throws IllegalArgumentException if initialBufferSize < 0. + */ + private DeferredFileOutputStream(final int threshold, final Path outputFile, final String prefix, final String suffix, final Path directory, + final int initialBufferSize) { + super(threshold); + this.outputPath = toPath(outputFile, null); + this.prefix = prefix; + this.suffix = suffix; + this.directory = toPath(directory, PathUtils::getTempDirectory); + this.memoryOutputStream = new ByteArrayOutputStream(checkBufferSize(initialBufferSize)); + this.currentOutputStream = memoryOutputStream; + } + + /** * Constructs an instance of this class which will trigger an event at the specified threshold, and save data to a temporary file beyond that point. The * initial buffer size will default to 32 bytes which is ByteArrayOutputStream's default buffer size. * |