talira

snappy-java

Fast Snappy compression and decompression for Java

open sourceApache-2.0free

snappy-java is a Java port of Snappy, Google's fast C++ compressor and decompressor. It uses JNI to reach speeds comparable to the native version, bundles native libraries for Windows, macOS, Linux and others and loads the right one for the machine, and stays safe with multiple class loaders such as Tomcat's. It compresses byte data and Java primitive arrays, with a BitShuffle step to improve their ratio, supports Snappy's framing format, and works as an OSGi bundle.

Problems it solves

  • compress data quickly in a Java app
  • use Snappy compression from the JVM
  • read and write Snappy-framed streams in Java

Features

  • Snappy compression and decompression at around 200 to 400 MB/s
  • JNI-based, with performance comparable to native Snappy
  • bundled native libraries for Windows, macOS, Linux and more
  • compresses Java primitive arrays, with BitShuffle to improve ratios
  • Snappy framing format
  • OSGi support and low memory use

Limitations

  • Its compression ratio is modest, about the same as LZF: Snappy aims at speed rather than size.1