Class CachedOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- org.apache.camel.converter.stream.CachedOutputStream
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
public class CachedOutputStream extends OutputStream
This output stream will store the content into a File if the stream context size is exceed the THRESHOLD value. The default THRESHOLD value isStreamCache.DEFAULT_SPOOL_THRESHOLDbytes . The temp file will store in the temp directory, you can configure it by setting the TEMP_DIR property. If you don't set the TEMP_DIR property, it will choose the directory which is set by the system property of "java.io.tmpdir". You can get a cached input stream of this stream. The temp file which is created with this output stream will be deleted when you close this output stream or the cached fileInputStream(s) is/are closed after all the exchanges using the temp file are completed.
-
-
Constructor Summary
Constructors Constructor Description CachedOutputStream(org.apache.camel.Exchange exchange)CachedOutputStream(org.apache.camel.Exchange exchange, boolean closedOnCompletion)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()booleanequals(Object obj)voidflush()OutputStreamgetCurrentStream()InputStreamgetInputStream()intgetStrategyBufferSize()InputStreamgetWrappedInputStream()inthashCode()org.apache.camel.StreamCachenewStreamCache()Creates a newStreamCachefrom the data cached in thisOutputStream.StringtoString()voidwrite(byte[] b)voidwrite(byte[] b, int off, int len)voidwrite(int b)-
Methods inherited from class java.io.OutputStream
nullOutputStream
-
-
-
-
Method Detail
-
flush
public void flush() throws IOException- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-
getCurrentStream
public OutputStream getCurrentStream()
-
write
public void write(byte[] b, int off, int len) throws IOException- Overrides:
writein classOutputStream- Throws:
IOException
-
write
public void write(byte[] b) throws IOException- Overrides:
writein classOutputStream- Throws:
IOException
-
write
public void write(int b) throws IOException- Specified by:
writein classOutputStream- Throws:
IOException
-
getInputStream
public InputStream getInputStream() throws IOException
- Throws:
IOException
-
getWrappedInputStream
public InputStream getWrappedInputStream() throws IOException
- Throws:
IOException
-
newStreamCache
public org.apache.camel.StreamCache newStreamCache() throws IOExceptionCreates a newStreamCachefrom the data cached in thisOutputStream.- Throws:
IOException
-
getStrategyBufferSize
public int getStrategyBufferSize()
-
-