org.apache.camel
Interface StreamCache

All Known Implementing Classes:
ByteArrayInputStreamCache, FileInputStreamCache, InputStreamCache, ReaderCache, SourceCache, StreamSourceCache

public interface StreamCache

Tagging interface to indicate that a type is capable of caching the underlying data stream.

This is a useful feature for avoiding message re-readability issues. This interface is mainly used by the StreamCachingInterceptor for determining if/how to wrap a stream-based message.

Version:

Field Summary
static long DEFAULT_SPOOL_THRESHOLD
           
 
Method Summary
 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
 

Field Detail

DEFAULT_SPOOL_THRESHOLD

static final long DEFAULT_SPOOL_THRESHOLD
See Also:
Constant Field Values
Method Detail

reset

void reset()
Resets the StreamCache for a new stream consumption.


writeTo

void writeTo(OutputStream os)
             throws IOException
Writes the stream to the given output

Parameters:
os - the destination to write to
Throws:
IOException - is thrown if write fails

inMemory

boolean inMemory()
Whether this StreamCache is in memory only or spooled to persistent storage such as files.


length

long length()
Gets the length of the cached stream.

The implementation may return 0 in cases where the length cannot be computed, or if the implementation does not support this.

Returns:
number of bytes in the cache.


Apache Camel