All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.ning.compress.lzf.parallel.WriteTask Maven / Gradle / Ivy

Go to download

Compression codec for LZF encoding for particularly encoding/decoding, with reasonable compression. Compressor is basic Lempel-Ziv codec, without Huffman (deflate/gzip) or statistical post-encoding. See "http://oldhome.schmorp.de/marc/liblzf.html" for more on original LZF package.

There is a newer version: 1.1.2
Show newest version
package com.ning.compress.lzf.parallel;

import java.io.OutputStream;
import java.util.concurrent.Future;

import com.ning.compress.lzf.LZFChunk;

/**
 * @author Cédrik LIME
 */
class WriteTask implements Runnable {
    private final OutputStream output;
    private final Future lzfFuture;
    private final PLZFOutputStream caller;

    public WriteTask(OutputStream output, Future lzfFuture, PLZFOutputStream caller) {
        super();
        this.output = output;
        this.lzfFuture = lzfFuture;
        this.caller = caller;
    }

    /** {@inheritDoc} */
    @Override
    public void run() {
        try {
            LZFChunk lzfChunk = lzfFuture.get();
            while (lzfChunk != null) {
                output.write(lzfChunk.getData());
                lzfChunk = lzfChunk.next();
            }
        } catch (Exception e) {
            caller.writeException = e;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy