public final class InputStreamCache extends ByteArrayInputStream implements StreamCache
StreamCache
for caching using an in-memory byte array.buf, count, mark, pos
DEFAULT_SPOOL_THRESHOLD
Constructor and Description |
---|
InputStreamCache(byte[] data) |
InputStreamCache(byte[] data,
int count) |
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 |
writeTo(OutputStream os)
Writes the stream to the given output
|
available, close, mark, markSupported, read, read, reset, skip
read
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
reset
public InputStreamCache(byte[] data)
public InputStreamCache(byte[] data, int count)
public void writeTo(OutputStream os) throws IOException
StreamCache
writeTo
in interface StreamCache
os
- the destination to write toIOException
- is thrown if write failspublic StreamCache copy(Exchange exchange)
StreamCache
copy
in interface StreamCache
exchange
- exchange in which the stream cache object is used;
can be used to delete resources of the stream cache when the exchange is completedpublic boolean inMemory()
StreamCache
StreamCache
is in memory only or
spooled to persistent storage such as files.inMemory
in interface StreamCache
public long length()
StreamCache
length
in interface StreamCache
Apache Camel