org.apache.camel.converter.stream
Class CachedByteArrayOutputStream

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

public final class CachedByteArrayOutputStream
extends ByteArrayOutputStream

A ByteArrayOutputStream that is capable of returning a InputStreamCache view of the buffer.

This implementation avoids any buffer copying when caching in memory InputStream as the buffer can be shared.


Field Summary
 
Fields inherited from class java.io.ByteArrayOutputStream
buf, count
 
Constructor Summary
CachedByteArrayOutputStream(int size)
           
 
Method Summary
 InputStreamCache newInputStreamCache()
          Creates a new InputStreamCache view of the byte array
 
Methods inherited from class java.io.ByteArrayOutputStream
close, reset, size, toByteArray, toString, toString, toString, write, write, writeTo
 
Methods inherited from class java.io.OutputStream
flush, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CachedByteArrayOutputStream

public CachedByteArrayOutputStream(int size)
Method Detail

newInputStreamCache

public InputStreamCache newInputStreamCache()
Creates a new InputStreamCache view of the byte array



Apache Camel