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)
TempStoreOutputStream
TempStoreOutputStream.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 TempStoreOutputStream
mimeType
- the MIME type or null
if the MIME type is unknown or
should be reset to unknownpublic String getMimeType()
public void setFileName(String filename)
TempStoreOutputStream
TempStoreOutputStream.getInputStream()
is
called. It might never be called if the file name is unknown.setFileName
in class TempStoreOutputStream
filename
- the file name or null
if the file name is unknown or
should be reset to unknownpublic String getFileName()
public long getLength()
TempStoreOutputStream
getLength
in class TempStoreOutputStream
public void write(byte[] buffer) throws IOException
write
in class OutputStream
IOException
public void write(byte[] buffer, int offset, int len) throws IOException
write
in class OutputStream
IOException
public void write(int oneByte) throws IOException
write
in class OutputStream
IOException
public void flush() throws IOException
flush
in interface Flushable
flush
in class OutputStream
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class OutputStream
IOException
public void destroy(Throwable cause)
destroy
in class TempStoreOutputStream
cause
- the throwable that caused the call of this method or
null
if no throwable object is availablepublic InputStream getInputStream() throws IOException
getInputStream
in class TempStoreOutputStream
IOException
Copyright © 2009-2015 The Apache Software Foundation. All Rights Reserved.