org.apache.chemistry.opencmis.server.shared
Class ThresholdOutputStream
java.lang.Object
java.io.OutputStream
org.apache.chemistry.opencmis.server.shared.ThresholdOutputStream
- All Implemented Interfaces:
- Closeable, Flushable
public class ThresholdOutputStream
- extends 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!
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ThresholdOutputStream
public ThresholdOutputStream(File tempDir,
int memoryThreshold)
ThresholdOutputStream
public ThresholdOutputStream(int initSize,
File tempDir,
int memoryThreshold)
getSize
public long getSize()
write
public void write(byte[] buffer)
throws IOException
- Overrides:
write
in class OutputStream
- Throws:
IOException
write
public void write(byte[] buffer,
int offset,
int len)
throws IOException
- Overrides:
write
in class OutputStream
- Throws:
IOException
write
public void write(int oneByte)
throws IOException
- Specified by:
write
in class OutputStream
- Throws:
IOException
flush
public void flush()
throws IOException
- Specified by:
flush
in interface Flushable
- Overrides:
flush
in class OutputStream
- Throws:
IOException
close
public void close()
throws IOException
- Specified by:
close
in interface Closeable
- Overrides:
close
in class OutputStream
- Throws:
IOException
destroy
public void destroy()
- Destroys the object before it has been read.
getInputStream
public InputStream getInputStream()
throws Exception
- Returns the data as an InputStream.
- Throws:
Exception
Copyright © 2009-2012 The Apache Software Foundation. All Rights Reserved.