org.apache.camel.converter.stream
Class CachedOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by org.apache.camel.converter.stream.CachedOutputStream
All Implemented Interfaces:
Closeable, Flushable

public class CachedOutputStream
extends OutputStream

This output stream will store the content into a File if the stream context size is exceed the THRESHOLD which's default value is 64K. 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 all cached fileInputStream is closed after the exchange is completed.


Field Summary
static String BUFFER_SIZE
           
static String TEMP_DIR
           
static String THRESHOLD
           
 
Constructor Summary
CachedOutputStream(Exchange exchange)
           
CachedOutputStream(Exchange exchange, boolean closedOnCompletion)
           
 
Method Summary
 void close()
           
 boolean equals(Object obj)
           
 void flush()
           
 int getBufferSize()
           
 InputStream getInputStream()
           
 StreamCache getStreamCache()
           
 InputStream getWrappedInputStream()
           
 int hashCode()
           
 String toString()
           
 void write(byte[] b)
           
 void write(byte[] b, int off, int len)
           
 void write(int b)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

THRESHOLD

public static final String THRESHOLD
See Also:
Constant Field Values

BUFFER_SIZE

public static final String BUFFER_SIZE
See Also:
Constant Field Values

TEMP_DIR

public static final String TEMP_DIR
See Also:
Constant Field Values
Constructor Detail

CachedOutputStream

public CachedOutputStream(Exchange exchange)

CachedOutputStream

public CachedOutputStream(Exchange exchange,
                          boolean closedOnCompletion)
Method Detail

flush

public void flush()
           throws IOException
Specified by:
flush in interface Flushable
Overrides:
flush in class OutputStream
Throws:
IOException

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Overrides:
close in class OutputStream
Throws:
IOException

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

write

public void write(byte[] b,
                  int off,
                  int len)
           throws IOException
Overrides:
write in class OutputStream
Throws:
IOException

write

public void write(byte[] b)
           throws IOException
Overrides:
write in class OutputStream
Throws:
IOException

write

public void write(int b)
           throws IOException
Specified by:
write in class OutputStream
Throws:
IOException

getInputStream

public InputStream getInputStream()
                           throws IOException
Throws:
IOException

getWrappedInputStream

public InputStream getWrappedInputStream()
                                  throws IOException
Throws:
IOException

getStreamCache

public StreamCache getStreamCache()
                           throws IOException
Throws:
IOException

getBufferSize

public int getBufferSize()


Apache CAMEL