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 value. The default THRESHOLD value is StreamCache.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 all cached fileInputStream is closed after the exchange is completed.


Field Summary
static String BUFFER_SIZE
          Deprecated. 
static String CIPHER_TRANSFORMATION
          Deprecated. 
static String TEMP_DIR
          Deprecated. 
static String THRESHOLD
          Deprecated. 
 
Constructor Summary
CachedOutputStream(Exchange exchange)
           
CachedOutputStream(Exchange exchange, boolean closedOnCompletion)
           
 
Method Summary
 void close()
           
 boolean equals(Object obj)
           
 void flush()
           
 int getBufferSize()
          Deprecated. use getStrategyBufferSize()
 OutputStream getCurrentStream()
           
 InputStream getInputStream()
           
 int getStrategyBufferSize()
           
 StreamCache getStreamCache()
          Deprecated. use newStreamCache()
 InputStream getWrappedInputStream()
           
 int hashCode()
           
 StreamCache newStreamCache()
          Creates a new StreamCache from the data cached in this OutputStream.
 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

@Deprecated
public static final String THRESHOLD
Deprecated. 
See Also:
Constant Field Values

BUFFER_SIZE

@Deprecated
public static final String BUFFER_SIZE
Deprecated. 
See Also:
Constant Field Values

TEMP_DIR

@Deprecated
public static final String TEMP_DIR
Deprecated. 
See Also:
Constant Field Values

CIPHER_TRANSFORMATION

@Deprecated
public static final String CIPHER_TRANSFORMATION
Deprecated. 
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

getCurrentStream

public OutputStream getCurrentStream()

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

@Deprecated
public StreamCache getStreamCache()
                           throws IOException
Deprecated. use newStreamCache()

Throws:
IOException

newStreamCache

public StreamCache newStreamCache()
                           throws IOException
Creates a new StreamCache from the data cached in this OutputStream.

Throws:
IOException

getBufferSize

@Deprecated
public int getBufferSize()
Deprecated. use getStrategyBufferSize()


getStrategyBufferSize

public int getStrategyBufferSize()


Apache Camel