org.apache.chemistry.opencmis.server.shared
Class ThresholdOutputStream
java.lang.Object
java.io.OutputStream
org.apache.chemistry.opencmis.server.shared.ThresholdOutputStream
- All Implemented Interfaces:
- java.io.Closeable, java.io.Flushable
public class ThresholdOutputStream
- extends java.io.OutputStream
An OutputStream that stores the data in main memory until it reaches a
threshold. If the threshold is passed the data is written to a temporary
file.
It it is important to close this OutputStream before
getInputStream() is called or call destroy() if the
InputStream isn't required!
|
Method Summary |
void |
close()
|
void |
destroy()
Destroys the object before it has been read. |
void |
flush()
|
java.io.InputStream |
getInputStream()
Returns the data as an InputStream. |
long |
getSize()
|
void |
write(byte[] buffer)
|
void |
write(byte[] buffer,
int offset,
int len)
|
void |
write(int oneByte)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ThresholdOutputStream
public ThresholdOutputStream(java.io.File tempDir,
int memoryThreshold)
ThresholdOutputStream
public ThresholdOutputStream(int initSize,
java.io.File tempDir,
int memoryThreshold)
getSize
public long getSize()
write
public void write(byte[] buffer)
throws java.io.IOException
- Overrides:
write in class java.io.OutputStream
- Throws:
java.io.IOException
write
public void write(byte[] buffer,
int offset,
int len)
throws java.io.IOException
- Overrides:
write in class java.io.OutputStream
- Throws:
java.io.IOException
write
public void write(int oneByte)
throws java.io.IOException
- Specified by:
write in class java.io.OutputStream
- Throws:
java.io.IOException
flush
public void flush()
throws java.io.IOException
- Specified by:
flush in interface java.io.Flushable- Overrides:
flush in class java.io.OutputStream
- Throws:
java.io.IOException
close
public void close()
throws java.io.IOException
- Specified by:
close in interface java.io.Closeable- Overrides:
close in class java.io.OutputStream
- Throws:
java.io.IOException
destroy
public void destroy()
- Destroys the object before it has been read.
getInputStream
public java.io.InputStream getInputStream()
throws java.lang.Exception
- Returns the data as an InputStream.
- Throws:
java.lang.Exception
Copyright © 2009-2012 The Apache Software Foundation. All Rights Reserved.