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_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
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 void
close()
boolean
equals(Object obj)
void
flush()
OutputStream
getCurrentStream()
InputStream
getInputStream()
int
getStrategyBufferSize()
InputStream
getWrappedInputStream()
int
hashCode()
org.apache.camel.StreamCache
newStreamCache()
Creates a newStreamCache
from the data cached in thisOutputStream
.String
toString()
void
write(byte[] b)
void
write(byte[] b, int off, int len)
void
write(int b)
-
Methods inherited from class java.io.OutputStream
nullOutputStream
-
-
-
-
Method Detail
-
flush
public void flush() throws IOException
- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
- Throws:
IOException
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException
-
getCurrentStream
public OutputStream getCurrentStream()
-
write
public void write(byte[] b, int off, int len) throws IOException
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
write
public void write(byte[] b) throws IOException
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
write
public void write(int b) throws IOException
- Specified by:
write
in 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 IOException
Creates a newStreamCache
from the data cached in thisOutputStream
.- Throws:
IOException
-
getStrategyBufferSize
public int getStrategyBufferSize()
-
-