Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Basic Java LZF codec, compatible with standard C LZF package
Java

Javadoc fix

latest commit c69f4fdfbb
Tatu Saloranta authored
Failed to load latest commit information.
src
testdata add testdata
.gitignore initial stream support added
LICENSE add license file
README.md update to refer to 1.0.3
VERSION.txt Fix #37 (need bit more clean up but start here)
pom.xml failed at making things exec, comment out for now
profile-comp-perf Refactor manual perf tests
profile-skip Refactor manual perf tests
profile-uncomp-perf Refactor manual perf tests
run-comp-perf Refactor manual perf tests
run-skip adding micro-benchmark
run-uncomp-perf Refactor manual perf tests

README.md

Ning-Compress

Overview

Ning-compress is a Java library for encoding and decoding data in LZF format, written by Tatu Saloranta (tatu.saloranta@iki.fi)

Data format and algorithm based on original LZF library by Marc A Lehmann. See LZF Format for full description.

Format differs slightly from some other adaptations, such as one used by H2 database project (by Thomas Mueller); although internal block compression structure is the same, block identifiers differ. This package uses the original LZF identifiers to be 100% compatible with existing command-line lzf tool(s).

LZF alfgorithm itself is optimized for speed, with somewhat more modest compression: compared to Deflate (algorithm gzip uses) LZF can be 5-6 times as fast to compress, and twice as fast to decompress.

Usage

See Wiki for more details; here's a "TL;DNR" version.

Both compression and decompression can be done either by streaming approach:

InputStream in = new LZFInputStream(new FileInputStream("data.lzf"));
OutputStream out = new LZFOutputStream(new FileOutputStream("results.lzf"));
InputStream compIn = new LZFCompressingInputStream(new FileInputStream("stuff.txt"));

or by block operation:

byte[] compressed = LZFEncoder.encode(uncompressedData);
byte[] uncompressed = LZFDecoder.decode(compressedData);

and you can even use the LZF jar as a command-line tool (it has manifest that points to 'com.ning.compress.lzf.LZF' as the class having main() method to call), like so:

java -jar compress-lzf-1.0.3.jar

(which will display necessary usage arguments for -c(ompressing) or -d(ecompressing) files.

Interoperability

Besides Java support, LZF codecs / bindings exist for non-JVM languages as well:

Related

Check out jvm-compress-benchmark for comparison of space- and time-efficiency of this LZF implementation, relative other available Java-accessible compression libraries.

More

Project Wiki.

Alternative High-Speed Lempel-Ziv Compressors

LZF belongs to a family of compression codecs called "simple Lempel-Ziv" codecs. Since LZ compression is also the first part of deflate compression (which is used, along with simple framing, for gzip), it can be viewed as "first-part of gzip" (second part being Huffman-encoding of compressed content).

There are many other codecs in this category, most notable (and competitive being)

all of which have very similar compression ratios (due to same underlying algorithm, differences coming from slight encoding variations, and efficiency differences in back-reference matching), and similar performance profiles regarding ratio of compression vs uncompression speeds.

Something went wrong with that request. Please try again.