java.io.Closeable, java.io.Flushable, java.lang.AutoCloseablepublic class MemoryOutputStream
extends org.apache.commons.io.output.ThresholdingOutputStream
| Constructor | Description |
|---|---|
MemoryOutputStream(long threshold) |
Constructs an instance of this class which will trigger throw
UnsupportedOperationException if the specified threshold is reached.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
close() |
Closes underlying output stream, and mark this as closed
|
byte[] |
getData() |
Returns the data for this output stream as an array of bytes.
|
protected java.io.OutputStream |
getStream() |
Returns the current output stream.
|
boolean |
isInMemory() |
Determines whether or not the data for this output stream has been retained in memory.
|
protected void |
thresholdReached() |
Not possible in GAE.
|
void |
writeTo(java.io.OutputStream out) |
Writes the data from this output stream to the specified output stream, after it has been
closed.
|
public MemoryOutputStream(long threshold)
threshold - the number of bytes at which to trigger an eventprotected java.io.OutputStream getStream()
throws java.io.IOException
getStream in class org.apache.commons.io.output.ThresholdingOutputStreamjava.io.IOException - if an error occursprotected void thresholdReached()
thresholdReached in class org.apache.commons.io.output.ThresholdingOutputStreampublic boolean isInMemory()
truepublic byte[] getData()
null if no such data is availablepublic void close()
throws java.io.IOException
close in interface java.lang.AutoCloseableclose in interface java.io.Closeableclose in class org.apache.commons.io.output.ThresholdingOutputStreamjava.io.IOException - if an error occurspublic void writeTo(java.io.OutputStream out)
throws java.io.IOException
out - output stream to write tojava.io.IOException - if this stream is not yet closed or an error occursCopyright © 2008–2018 The Aspectran Project. All rights reserved.