Skip to content
cowtowncoder edited this page May 26, 2012 · 30 revisions

Home: Ning-compress

This is the Wiki home for Ning-compress project.

Overview

Ning-compress is a Java library for encoding and decoding data, written by Tatu Saloranta ([email protected])

The primary compression format is LZF; but starting with version 0.9, there is also support for basic GZIP; latter uses low-level JDK-provided Deflate functionality (which is based on native zlib).

LZF data format is compatible with the original LZF library by Marc A Lehmann. LZF 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 GZIP (aka Deflate) LZF can be 5-6 times as fast to compress, and twice as fast to decompress.

Documentation

Javadocs:

Download

From Maven repository (http://repo1.maven.org/maven2/com/ning/compress-lzf/)

Usage

Typical usage is by using one of programmatic interfaces:

  • block-based interface (LZFEncoder, LZFDecoder)
  • streaming interface (LZFInputStream, LZFOutputStream)
  • or, for 'reverse' direction: 'LZFCompressingInputStream'
  • "push" interface (reverse of streaming): LZFUncompressor (NOTE: only for un-/decompression)

but it is also possibly to use jar as a command-line tool since it has manifest that points to 'com.ning.compress.lzf.LZF' as the class having main() method to call.

This means that you can use it like:

java -jar compress-lzf-0.9.4.jar

(which will display necessary usage arguments)

Finally, jar is also a valid (and extremely simple) OSGi bundle to make it work nicely on OSGi containers.

Related

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

Clone this wiki locally