By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,260 Members | 1,338 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,260 IT Pros & Developers. It's quick & easy.

Help SharpZipLib Unzip from MemoryStream

P: n/a
I'm write a code with SharpZipLib for Zip files in MemoryStream...
I don't succeed to make Unzip....

This my code for Zip :

Private function ZipFiles(Files() as string) as MemoryStream
Dim StrFile As String
Dim ms As MemoryStream = New System.IO.MemoryStream
Dim s As ZipOutputStream = New ZipOutputStream(ms)
s.SetLevel(5)
For Each StrFile In Files
Dim fileName As String = StrFile
Dim fs As FileStream = File.OpenRead(fileName)
Dim buffer() As Byte = New Byte(fs.Length) {}
fs.Read(buffer, 0, buffer.Length)
Dim entry As ZipEntry = New ZipEntry(fileName)
s.PutNextEntry(entry)
s.Write(buffer, 0, buffer.Length)
Next
s.Finish()

Return ms
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
What's your code for unzip? What problems are you having? Have you
looked at the many good samples in the docs?

Also there are two mechanisms for unzip, ZipFile which gives random
file access and ZipInputStream which gives sequential file access.

One thing to note is that in some cases the zip library will only read
files in a small amount at a time--even as little as one byte at a
time--so you have to read the files in a loop filling a buffer and
tranferring to the other stream. Assuming you can read the file into a
single buffer will eventually lead to errors (and is a waiste of
resources).

HTH,

Sam

B-Line is now hiring one Washington D.C. area VB.NET
developer for WinForms + WebServices position.
Seaking mid to senior level developer. For
information or to apply e-mail resume to
sam_blinex_com.
Nov 21 '05 #2

P: n/a
Thank you for the response...
I have resolved
Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.