我应该在SharpZipLib中选择哪种压缩类型? [英] Which compression type should i choose in SharpZipLib?

查看:164
本文介绍了我应该在SharpZipLib中选择哪种压缩类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个文件传输应用程序可以发送文件和文件夹。 (服务器 - 客户端)

我试图通过TCP(套接字)发送数据,我已经为传输数据的方式做了一些规则,所以如果它发送一个大文件夹有很多文件,它应该将它们压缩成一个单一的zip文件,然后当该zip文件发送,接收器必须解压缩它。
,所以我决定使用 SharpZibLib ,我有一个问题。

  • 我应该选择哪种类型的压缩?

    我阅读了有关ZIP和GZIP之间的差异,发现GZIP有更好的压缩减少的大小,因为我不需要从GZIP文件中提取一个特殊的文件,以后,没有必要使用ZIP而不是GZIP!
    但在该库有很多类型,我还是不知道,所以我应该使用GZIP还是其他类型的应用程序会更好吗?

    I have a File Transfer Application that sends files and folders. (Server - client)
    I am trying to send data over TCP (sockets), I've made some rules for the way of transferring the data, so if it's sending a large folder that has many files, it should compress them into a single zip file first then when that zip file sent, the receiver has to decompress it. so I have decided to use SharpZibLib and I have got a question about it.

  • Which type of compressing should i choose for my application?
    I read about the differences between ZIP and GZIP, and found that GZIP has better compression to reduce the size, and as I don't need to extract a special file from the GZIP file later, there's no need to use ZIP instead of GZIP!
    but in that library there are many types that I still don't know, so should I use GZIP or another type would be better for my application?

    PS:
    ,使用SharpZipLib的意义是把(太多的文件)放在一个文件中,所以它会发送得比发送(太多的文件)一个一个快。

    < a href =http://stackoverflow.com/questions/10174379/file-transfer-with-maximum-speed-on-lan#comment13056012_10174379>这里有更多详情。

    推荐答案

    为了速度,你应该使用gzip / zip。我假设库允许你选择压缩级别。您应该尝试低水平,例如。 1到4,看看什么速度和压缩程度最适合您的应用程序。

    For speed, you should use gzip / zip. I presume that the library allows you to select the compression level. You should experiment with low levels, e.g. 1 to 4, to see what speed and degree of compression works best with your application.

    gzip / zip将在相同的压缩效率下超越LZW的速度。我发现压缩级别3比LZW快,压缩得更好。

    gzip / zip will outperform LZW in speed at the same compression effectiveness. I find that compression level 3 is faster than LZW and compresses much better.

    bzip2压缩比gzip / zip更好,但需要更长的时间。

    bzip2 will compress better than gzip / zip, but will take much longer.

    其他选择不是压缩器。

    这篇关于我应该在SharpZipLib中选择哪种压缩类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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