public interface StreamCache
StreamCachingStrategy
for determining if/how to wrap a stream-based message.
The Camel routing engine uses the org.apache.camel.processor.CamelInternalProcessor.StreamCachingAdvice
to
apply the stream cache during routing.
It is recommended in the copy(Exchange)
method to let the copied stream start from the start. If the
implementation does not support copy, then return null.Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_SPOOL_THRESHOLD |
Modifier and Type | Method and Description |
---|---|
StreamCache |
copy(Exchange exchange)
Create a copy of the stream.
|
boolean |
inMemory()
Whether this
StreamCache is in memory only or spooled to persistent storage such as files. |
long |
length()
Gets the length of the cached stream.
|
void |
reset()
Resets the StreamCache for a new stream consumption.
|
void |
writeTo(OutputStream os)
Writes the stream to the given output
|
static final long DEFAULT_SPOOL_THRESHOLD
void reset()
void writeTo(OutputStream os) throws IOException
os
- the destination to write toIOException
- is thrown if write failsStreamCache copy(Exchange exchange) throws IOException
exchange
- exchange in which the stream cache object is used; can be used to delete resources of
the stream cache when the exchange is completedIOException
- is thrown if the copy failsboolean inMemory()
StreamCache
is in memory only or spooled to persistent storage such as files.long length()
Apache Camel