public class ThresholdOutputStream extends TempStoreOutputStream
getInputStream() is called or call #destroy() if the
InputStream isn't required!| Modifier and Type | Class and Description |
|---|---|
class |
ThresholdOutputStream.ThresholdInputStream
Provides information about the input stream.
|
| Constructor and Description |
|---|
ThresholdOutputStream(File tempDir,
int memoryThreshold,
long maxContentSize)
Constructor.
|
ThresholdOutputStream(File tempDir,
int memoryThreshold,
long maxContentSize,
boolean encrypt)
Constructor.
|
ThresholdOutputStream(int initSize,
File tempDir,
int memoryThreshold,
long maxContentSize,
boolean encrypt)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
destroy(Throwable cause)
Destroys the object before it has been read.
|
void |
flush() |
String |
getFileName() |
InputStream |
getInputStream()
Returns the data as an InputStream.
|
long |
getLength()
Returns the length of the stream in bytes.
|
String |
getMimeType() |
void |
setFileName(String filename)
Sets the file name.
|
void |
setMimeType(String mimeType)
Sets the MIME type of the stream.
|
void |
write(byte[] buffer) |
void |
write(byte[] buffer,
int offset,
int len) |
void |
write(int oneByte) |
public ThresholdOutputStream(File tempDir, int memoryThreshold, long maxContentSize)
tempDir - temp directory or null for the default temp directorymemoryThreshold - memory threshold in bytesmaxContentSize - max size of the content in bytes (-1 to disable the check)public ThresholdOutputStream(File tempDir, int memoryThreshold, long maxContentSize, boolean encrypt)
tempDir - temp directory or null for the default temp directorymemoryThreshold - memory threshold in bytesmaxContentSize - max size of the content in bytes (-1 to disable the check)public ThresholdOutputStream(int initSize,
File tempDir,
int memoryThreshold,
long maxContentSize,
boolean encrypt)
initSize - initial internal buffer sizetempDir - temp directory or null for the default temp directorymemoryThreshold - memory threshold in bytesmaxContentSize - max size of the content in bytes (-1 to disable the check)encrypt - indicates if temporary files must be encryptedpublic void setMimeType(String mimeType)
TempStoreOutputStreamTempStoreOutputStream.getInputStream() is
called. It might never be called if the MIME type is unknown or multiple
times if previous MIME type detections were inaccurate.setMimeType in class TempStoreOutputStreammimeType - the MIME type or null if the MIME type is unknown or
should be reset to unknownpublic String getMimeType()
public void setFileName(String filename)
TempStoreOutputStreamTempStoreOutputStream.getInputStream() is
called. It might never be called if the file name is unknown.setFileName in class TempStoreOutputStreamfilename - the file name or null if the file name is unknown or
should be reset to unknownpublic String getFileName()
public long getLength()
TempStoreOutputStreamgetLength in class TempStoreOutputStreampublic void write(byte[] buffer)
throws IOException
write in class OutputStreamIOExceptionpublic void write(byte[] buffer,
int offset,
int len)
throws IOException
write in class OutputStreamIOExceptionpublic void write(int oneByte)
throws IOException
write in class OutputStreamIOExceptionpublic void flush()
throws IOException
flush in interface Flushableflush in class OutputStreamIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class OutputStreamIOExceptionpublic void destroy(Throwable cause)
destroy in class TempStoreOutputStreamcause - the throwable that caused the call of this method or
null if no throwable object is availablepublic InputStream getInputStream() throws IOException
getInputStream in class TempStoreOutputStreamIOExceptionCopyright © 2009-2015 The Apache Software Foundation. All Rights Reserved.