Example usage for org.apache.commons.fileupload DeferredFileOutputStream DeferredFileOutputStream

List of usage examples for org.apache.commons.fileupload DeferredFileOutputStream DeferredFileOutputStream

Introduction

In this page you can find the example usage for org.apache.commons.fileupload DeferredFileOutputStream DeferredFileOutputStream.

Prototype

public DeferredFileOutputStream(int threshold, File outputFile) 

Source Link

Document

Constructs an instance of this class which will trigger an event at the specified threshold, and save data to a file beyond that point.

Usage

From source file:com.w4t.engine.requests.UploadRequestFileItem.java

/**
 * <p>returns an {@link java.io.OutputStream OutputStream}that can be used for
 * storing the contents of the file.</p>
 * //from w  w  w . j  a v a2s . co m
 * @return An {@link java.io.OutputStream OutputStream}that can be used for
 *         storing the contensts of the file.
 * @exception IOException if an error occurs.
 */
public OutputStream getOutputStream() throws IOException {
    if (dfos == null) {
        File outputFile = getTempFile();
        if (isFormField()) {
            dfos = new DeferredFileOutputStream(DEFAULT_OUTPUTSTREAM_SIZE, outputFile);
        } else {
            dfos = new DeferredFileOutputStream(sizeThreshold, outputFile);
        }
    }
    return dfos;
}