com.ning.compress.lzf.parallel.WriteTask Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of compress-lzf Show documentation
Show all versions of compress-lzf Show documentation
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.
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