public abstract class TempStoreOutputStream extends OutputStream
getInputStream()
and getLength()
methods are not called
before all bytes have been written to this output stream and the
OutputStream.close()
method has been called. The destroy(Throwable)
method can be called at any time and indicates that this stream is not needed
anymore and attached resources can be cleaned up.Constructor and Description |
---|
TempStoreOutputStream() |
Modifier and Type | Method and Description |
---|---|
abstract void |
destroy(Throwable cause)
This method is called if the stream has to be released before it is fully
written or read.
|
abstract InputStream |
getInputStream()
Returns an
InputStream that serves the content that has been
provided to this TempStoreOutputStream instance. |
abstract long |
getLength()
Returns the length of the stream in bytes.
|
abstract void |
setFileName(String filename)
Sets the file name.
|
abstract void |
setMimeType(String mimeType)
Sets the MIME type of the stream.
|
public abstract void setMimeType(String mimeType)
getInputStream()
is
called. It might never be called if the MIME type is unknown or multiple
times if previous MIME type detections were inaccurate.mimeType
- the MIME type or null
if the MIME type is unknown or
should be reset to unknownpublic abstract void setFileName(String filename)
getInputStream()
is
called. It might never be called if the file name is unknown.filename
- the file name or null
if the file name is unknown or
should be reset to unknownpublic abstract InputStream getInputStream() throws IOException
InputStream
that serves the content that has been
provided to this TempStoreOutputStream
instance.
If this method is called multiple times, the same InputStream
object must be returned.
Implementations should clean up all attached resources when this stream
is closed.IOException
- if the input stream could not be createdpublic abstract long getLength()
public abstract void destroy(Throwable cause)
cause
- the throwable that caused the call of this method or
null
if no throwable object is availableCopyright © 2009–2017 The Apache Software Foundation. All rights reserved.