Search in sources :

Example 11 with OutputStreamBuilder

use of org.apache.camel.converter.stream.OutputStreamBuilder in project camel by apache.

the class ZipDataFormat method unmarshal.

public Object unmarshal(final Exchange exchange, final InputStream inputStream) throws Exception {
    InflaterInputStream inflaterInputStream = new InflaterInputStream(inputStream);
    OutputStreamBuilder osb = OutputStreamBuilder.withExchange(exchange);
    try {
        IOHelper.copy(inflaterInputStream, osb);
        return osb.build();
    } finally {
        // must close input streams
        IOHelper.close(osb, inflaterInputStream, inputStream);
    }
}
Also used : InflaterInputStream(java.util.zip.InflaterInputStream) OutputStreamBuilder(org.apache.camel.converter.stream.OutputStreamBuilder)

Aggregations

OutputStreamBuilder (org.apache.camel.converter.stream.OutputStreamBuilder)11 InputStream (java.io.InputStream)3 IOException (java.io.IOException)2 DbxEntry (com.dropbox.core.DbxEntry)1 DbxException (com.dropbox.core.DbxException)1 LZFInputStream (com.ning.compress.lzf.LZFInputStream)1 BufferedInputStream (java.io.BufferedInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 ByteBuffer (java.nio.ByteBuffer)1 Key (java.security.Key)1 GZIPInputStream (java.util.zip.GZIPInputStream)1 InflaterInputStream (java.util.zip.InflaterInputStream)1 ZipEntry (java.util.zip.ZipEntry)1 ZipInputStream (java.util.zip.ZipInputStream)1 CipherInputStream (javax.crypto.CipherInputStream)1 AsyncCallback (org.apache.camel.AsyncCallback)1 CamelContext (org.apache.camel.CamelContext)1 Exchange (org.apache.camel.Exchange)1 Message (org.apache.camel.Message)1 StreamCache (org.apache.camel.StreamCache)1