Class CachedOutputStream
java.lang.Object
java.io.OutputStream
org.apache.camel.converter.stream.CachedOutputStream
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
This output stream will store the content into a File if the stream context size is exceed the THRESHOLD value. The
default THRESHOLD value is
StreamCache.DEFAULT_SPOOL_THRESHOLD
bytes .
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
ConstructorsConstructorDescriptionCachedOutputStream
(org.apache.camel.Exchange exchange) CachedOutputStream
(org.apache.camel.Exchange exchange, boolean closedOnCompletion) -
Method Summary
Methods inherited from class java.io.OutputStream
nullOutputStream
-
Constructor Details
-
CachedOutputStream
public CachedOutputStream(org.apache.camel.Exchange exchange) -
CachedOutputStream
public CachedOutputStream(org.apache.camel.Exchange exchange, boolean closedOnCompletion)
-
-
Method Details
-
flush
- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException
-
equals
-
hashCode
public int hashCode() -
getCurrentStream
-
toString
-
write
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
write
- Specified by:
write
in classOutputStream
- Throws:
IOException
-
getInputStream
- Throws:
IOException
-
getWrappedInputStream
- Throws:
IOException
-
newStreamCache
Creates a newStreamCache
from the data cached in thisOutputStream
.- Throws:
IOException
-
getStrategyBufferSize
public int getStrategyBufferSize()
-