468,513 Members | 1,760 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,513 developers. It's quick & easy.

Zip file length ?

Use ICSharpCode.SharpZipLib

Can view files in zip library. Files are being created the wrong size when
unzipped. Sample code I found in this newsgroup. I thought I could change
from s.length to onefile.size, but that doesn't work. Any idea?

Thanks.

Dim zipfile As New ICSharpCode.SharpZipLib.Zip.ZipFile("S:\Temp\test. zip")
Dim onefile As ZipEntry = zipfile.GetEntry("test.txt")
Dim s As System.IO.Stream = zipfile.GetInputStream(onefile)
Dim length As Long = s.Length

Dim bytes(length) As Byte
s.Read(bytes, 0, length)
Dim newfile As New System.IO.FileStream("test.txt",
IO.FileMode.Create)
newfile.Write(bytes, 0, length)
newfile.Flush()
newfile.Close()
Nov 20 '05 #1
1 2391
Masahiro Ito <ma**@pleasespamgoaway.it> wrote in
news:Xn***********************@216.196.105.130:
Use ICSharpCode.SharpZipLib

Can view files in zip library. Files are being created the wrong size
when unzipped. Sample code I found in this newsgroup. I thought I
could change from s.length to onefile.size, but that doesn't work.
Any idea?

Thanks.

Dim zipfile As New
ICSharpCode.SharpZipLib.Zip.ZipFile("S:\Temp\test. zip")
Dim onefile As ZipEntry = zipfile.GetEntry("test.txt")
Dim s As System.IO.Stream = zipfile.GetInputStream(onefile)
Dim length As Long = s.Length

Dim bytes(length) As Byte
s.Read(bytes, 0, length)
Dim newfile As New System.IO.FileStream("test.txt",
IO.FileMode.Create)
newfile.Write(bytes, 0, length)
newfile.Flush()
newfile.Close()


<bump>
Nov 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

14 posts views Thread by Luiz Antonio Gomes Pican?o | last post: by
1 post views Thread by Jerry John | last post: by
9 posts views Thread by Adi | last post: by
7 posts views Thread by ConfusedAlot | last post: by
19 posts views Thread by Lee Crabtree | last post: by
4 posts views Thread by MikeJ | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.