1

I'm looking for a Java compression library that:

  • is good for XML
  • has a small footprint
  • is fast (rather than achieves high compression ratio - speed is more important)
  • easy to use

What do you guys suggest?

Thanks

3
  • What do you mean by an XML compression library. Commented Jul 2, 2010 at 15:48
  • do you mean minimize (stripping all the blanks, etc) or compression (like zip or rar)? Commented Jul 2, 2010 at 15:54
  • minimize would be a good start, though general compression that meets the requirements would be better - thanks! Commented Jul 2, 2010 at 15:54

3 Answers 3

4

There are XML minifiers, but for compression, XML is just plain text, very verbose and repetitive, but still only plain text. You will have to look at something like gzip, or any other general compression library and try them, there is no such thing as an XML specific compression library.

Sign up to request clarification or add additional context in comments.

Comments

2

Java has some built in classes that can be used for the type of compression you're contemplating.

https://docs.oracle.com/javase/1.5.0/docs/api/java/util/zip/Deflater.html

https://docs.oracle.com/javase/1.5.0/docs/api/java/util/zip/Inflater.html

Comments

0

As to basic Java compression libraries, you can check out jvm-compressor-benchmark; two leading candidates in very-fast category would be Snappy-java and LZF -- former is fastest as it uses fast C codecs via JNI, and latter is fastest of pure Java codecs. Both work well for XML; while they don't get quite as good compression ratio as gzip (deflate), they are significantly faster: compression is typically 3-5x faster, and decompression 1.5 - 2x faster.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.