[英]Lightweight Java compression library?
I'm looking for a Java compression library that:我正在寻找一个 Java 压缩库:
What do you guys suggest?你们有什么建议?
Thanks谢谢
There are XML minifiers, but for compression, XML is just plain text, very verbose and repetitive, but still only plain text.有 XML 压缩器,但对于压缩,XML 只是纯文本,非常冗长和重复,但仍然只是纯文本。 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.
您将不得不查看gzip或任何其他通用压缩库之类的内容并尝试使用它们,没有特定于 XML 的压缩库之类的东西。
Java has some built in classes that can be used for the type of compression you're contemplating. Java 有一些内置类,可用于您正在考虑的压缩类型。
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/Deflater.html
https://docs.oracle.com/javase/1.5.0/docs/api/java/util/zip/Inflater.html https://docs.oracle.com/javase/1.5.0/docs/api/java/util/zip/Inflater.html
As to basic Java compression libraries, you can check out jvm-compressor-benchmark ;至于基本的Java压缩库,你可以查看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.
超快类别中的两个主要候选者是 Snappy-java 和 LZF——前者最快,因为它通过 JNI 使用快速 C 编解码器,后者是纯 Java 编解码器中最快的。 Both work well for XML;
两者都适用于 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.
虽然它们的压缩率不如 gzip (deflate),但它们明显更快:压缩速度通常快 3-5 倍,解压速度快 1.5 - 2 倍。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.