在Android上数据通信pression(比java.util.zip其他?) [英] Data compression on Android (other than java.util.zip ?)

查看:99
本文介绍了在Android上数据通信pression(比java.util.zip其他?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有很多的数据(文本格式)从设备发送。这显然​​意味着,我应该COM preSS它。但我的问题是,是否还有做其他比拉链算法(这样)的任何方式。我问这个问题的原因是在这里 > - 为文本文件,即7-Zip是两倍拉链更好的(!)。这是一个显著的增益。也许还有更好的算法。

I have a lot of data (text format) to send from a device. It obviously means that I should compress it. But my question is whether there are any ways of doing it other than by zip algorithm (like this). The reason I am asking this question is over here - for a text file i.e. 7-zip is twice (!) better than zip. Which is a significant gain. And maybe there are even better algorithms.

那么,有没有数据COM pression(比ZIP更好)提供任何有效的方式为Android?

So are there any effective ways of data compression (better than zip) available for Android?

推荐答案

您将需要编译另一个库到code,因为我怀疑比的zlib 可作为对Android的标准库的一部分。

You would need to compile another library into your code, since I doubt that compression algorithms other than zlib are available as part of the standard libraries on the Android.

在7-ZIP算法,你指的实际上是所谓的LZMA,你可以在图书馆的形式得到了 LZMA SDK 。该人士$ ​​C $ c是在Java中可用,以及C.如果你可以链接C code转换您的应用程序,这将是preferable速度。

The 7-zip algorithm you refer to is actually called LZMA, which you can get in library form in the LZMA SDK. The source code is available in Java as well as C. If you can link C code into your application, that would be preferable for speed.

由于没有这样的东西作为免费的午餐,速度是很重要的。 LZMA将需要更多的内存和更多的执行时间,以达到更好的COM pression。你应该尝试LZMA和zlib对数据看,你想权衡的执行时间和COM pression的回落,既要选择一个包,并选择一个包中的COM pression水平。

Since there's no such thing as a free lunch, the speed is important. LZMA will require much more memory and much more execution time to achieve the improved compression. You should experiment with LZMA and zlib on your data to see where you would like the tradeoff to fall between execution time and compression, both to choose a package and to pick compression levels within a package.

如果你发现你想要走另外一条路,少COM pression和速度比zlib的还要高,你可以看看的 LZ4

If you find that you'd like to go the other way, to less compression and even higher speed than zlib, you can look at lz4.

这篇关于在Android上数据通信pression(比java.util.zip其他?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆