开发者

how do i unzip stream while reading it in c# [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical a开发者_JAVA百科nd cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 12 years ago.

i read a zip file in my application and i don't want to extract after i read it all ..

i want to extract it while i am reading it.

so how do i extract stream of bytes for a file while i am reading it ?


The GZipStream and DeflateStream classes are wrappers around a normal Stream object. This means that you can extract the data as you're going along before a) the whole file has been downloaded and b) without loading all of the data in to memory.

These are available in .NET 4 upwards, otherwise you'll need to use #ZipLib as suggested.

EDIT: After looking around it would appear that #ZipLib is definitely the way forwards with this. The same principles apply to these classes in that they are streams, they can work as the file is being downloaded or read over a network and they don't require the whole file to be in memory. I'm currently using it in a project to open zip files from an http server, so I've seen it in action!


The .NET Base Class Library doesn't include classes to stream .zip files. Take a look at SharpZipLib.


Here are various examples of compression/decompression using the #Zip library.

http://wiki.sharpdevelop.net/SharpZipLib-Zip-Samples.ashx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜