Definition at line 81 of file DeferredFileOutputStream.java.
Public Member Functions | |
DeferredFileOutputStream (int threshold, File outputFile) | |
Constructs an instance of this class which will trigger an event at the specified threshold, and save data to a file beyond that point. | |
boolean | isInMemory () |
Determines whether or not the data for this output stream has been retained in memory. | |
byte[] | getData () |
Returns the data for this output stream as an array of bytes, assuming that the data has been retained in memory. | |
File | getFile () |
Returns the data for this output stream as a File , assuming that the data was written to disk. | |
Protected Member Functions | |
OutputStream | getStream () throws IOException |
Returns the current output stream. | |
void | thresholdReached () throws IOException |
Switches the underlying output stream from a memory based stream to one that is backed by disk. |
org.apache.commons.fileupload.DeferredFileOutputStream.DeferredFileOutputStream | ( | int | threshold, | |
File | outputFile | |||
) |
Constructs an instance of this class which will trigger an event at the specified threshold, and save data to a file beyond that point.
threshold | The number of bytes at which to trigger an event. | |
outputFile | The file to which data is saved beyond the threshold. |
Definition at line 126 of file DeferredFileOutputStream.java.
OutputStream org.apache.commons.fileupload.DeferredFileOutputStream.getStream | ( | ) | throws IOException [protected, virtual] |
Returns the current output stream.
This may be memory based or disk based, depending on the current state with respect to the threshold.
IOException | if an error occurs. |
Implements org.apache.commons.fileupload.ThresholdingOutputStream.
Definition at line 147 of file DeferredFileOutputStream.java.
void org.apache.commons.fileupload.DeferredFileOutputStream.thresholdReached | ( | ) | throws IOException [protected, virtual] |
Switches the underlying output stream from a memory based stream to one that is backed by disk.
This is the point at which we realise that too much data is being written to keep in memory, so we elect to switch to disk-based storage.
IOException | if an error occurs. |
Implements org.apache.commons.fileupload.ThresholdingOutputStream.
Definition at line 161 of file DeferredFileOutputStream.java.
boolean org.apache.commons.fileupload.DeferredFileOutputStream.isInMemory | ( | ) |
Determines whether or not the data for this output stream has been retained in memory.
true
if the data is available in memory; false
otherwise. Definition at line 182 of file DeferredFileOutputStream.java.
References org.apache.commons.fileupload.ThresholdingOutputStream.isThresholdExceeded().
Referenced by org.apache.commons.fileupload.DefaultFileItem.get(), org.apache.commons.fileupload.DefaultFileItem.getInputStream(), org.apache.commons.fileupload.DefaultFileItem.getSize(), and org.apache.commons.fileupload.DefaultFileItem.isInMemory().
byte [] org.apache.commons.fileupload.DeferredFileOutputStream.getData | ( | ) |
Returns the data for this output stream as an array of bytes, assuming that the data has been retained in memory.
If the data was written to disk, this method returns null
.
null
if no such data is available. Definition at line 196 of file DeferredFileOutputStream.java.
Referenced by org.apache.commons.fileupload.DefaultFileItem.get(), org.apache.commons.fileupload.DefaultFileItem.getInputStream(), and org.apache.commons.fileupload.DefaultFileItem.getSize().
File org.apache.commons.fileupload.DeferredFileOutputStream.getFile | ( | ) |
Returns the data for this output stream as a File
, assuming that the data was written to disk.
If the data was retained in memory, this method returns null
.
null
if no such file exists. Definition at line 214 of file DeferredFileOutputStream.java.
Referenced by org.apache.commons.fileupload.DefaultFileItem.finalize(), org.apache.commons.fileupload.DefaultFileItem.get(), org.apache.commons.fileupload.DefaultFileItem.getInputStream(), org.apache.commons.fileupload.DefaultFileItem.getSize(), and org.apache.commons.fileupload.DefaultFileItem.getStoreLocation().