Search in sources :

Example 1 with PLZFOutputStream

use of com.ning.compress.lzf.parallel.PLZFOutputStream in project camel by apache.

the class LZFDataFormat method marshal.

@Override
public void marshal(final Exchange exchange, final Object graph, final OutputStream stream) throws Exception {
    InputStream is = exchange.getContext().getTypeConverter().mandatoryConvertTo(InputStream.class, exchange, graph);
    OutputStream compressedOutput = parallelCompression ? new PLZFOutputStream(stream) : new LZFOutputStream(stream);
    try {
        IOHelper.copy(is, compressedOutput);
    } finally {
        // must close all input streams
        IOHelper.close(is, compressedOutput);
    }
}
Also used : PLZFOutputStream(com.ning.compress.lzf.parallel.PLZFOutputStream) LZFInputStream(com.ning.compress.lzf.LZFInputStream) InputStream(java.io.InputStream) OutputStream(java.io.OutputStream) LZFOutputStream(com.ning.compress.lzf.LZFOutputStream) PLZFOutputStream(com.ning.compress.lzf.parallel.PLZFOutputStream) LZFOutputStream(com.ning.compress.lzf.LZFOutputStream) PLZFOutputStream(com.ning.compress.lzf.parallel.PLZFOutputStream)

Aggregations

LZFInputStream (com.ning.compress.lzf.LZFInputStream)1 LZFOutputStream (com.ning.compress.lzf.LZFOutputStream)1 PLZFOutputStream (com.ning.compress.lzf.parallel.PLZFOutputStream)1 InputStream (java.io.InputStream)1 OutputStream (java.io.OutputStream)1