关于压缩文件 [英] Regarding Zipped Files

查看:92
本文介绍了关于压缩文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在处理硬盘中的一些压缩文件.我已使用Ionic.Zip将所有zip文件提取到我的目录中以进行读取.但这花了太长时间,因为我认为文件IO会花费很多时间.

因此,我尝试使用内存映射"文件来加快处理过程,以便可以将文件提取到虚拟内存中,但是它不能作为zip1.ExtractAll(Destination_path)起作用.需要一个目标路径,而我无法获得一个用于内存映射文件的路径.

因此,我尝试将压缩文件读入流中(使用Gzip库),但我不断收到错误消息"GZip标头中的魔术数字不正确.请确保您在GZip流中传递."

我的问题是:有什么办法可以减少我提取硬盘上文件的时间,还是有什么我不需要提取和获取所有信息的方法?如果有人知道答案,请告诉我.

请注意,我的应用程序基于Windows.
谢谢

Hello Everyone,

I am working on some zipped files which I have in my hard disk. I have used the Ionic.Zip to extract all the zip files to my directory in order to read them. But this is taking too long as I suppose File IO takes a hell of a lot of time.

So I tried using Memory mapped files in order to make the process faster so that I can extract the files on the virtual memory, but this didn''t work as zip1.ExtractAll(Destination_path); requires a destination path and I cant get one for the memory mapped files.

So I tried reading the zipped files into stream(using Gzip Library) but I keep on getting the error "The magic number in GZip header is not correct. Make sure you are passing in a GZip stream."

My Question is : Is there any way I can reduce the amount of time taken to extract the files on my hard disk or is there any way I dont have to extract and get all the information?Please let me know if someone knows the answer.

Please note my application is windows based.
Thanks

推荐答案

您可以尝试SharpZipLib库:

http://www.icsharpcode.net/OpenSource/SharpZipLib/Download.aspx [ ^ ]

SharpZipLib的样本:
http://wiki.sharpdevelop.net/SharpZipLib-Zip-Samples.ashx [ ^ ]
You can try the SharpZipLib library:

http://www.icsharpcode.net/OpenSource/SharpZipLib/Download.aspx[^]

Samples for SharpZipLib:
http://wiki.sharpdevelop.net/SharpZipLib-Zip-Samples.ashx[^]


解决方案1中提到的#ziplib,可以使用SevenZipSharp,它是著名的7-Zip的.NET包装:
http://en.wikipedia.org/wiki/7-Zip [ http://sevenzipsharp.codeplex.com/ [ ^ ].

这两个ZIP库都是开源的. (与ASP.NET无任何关系:-))

—SA
In alternative to #ziplib mentioned in Solution 1, you can use SevenZipSharp, a .NET wrapper of the famous 7-Zip:
http://en.wikipedia.org/wiki/7-Zip[^],
http://sevenzipsharp.codeplex.com/[^].

Both ZIP libraries are open-source. (And having nothing to do with ASP.NET :-))

—SA


这篇关于关于压缩文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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