Zip file length ?

  • Thread starter Thread starter Masahiro Ito
  • Start date Start date
M

Masahiro Ito

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()
 
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>
 
Back
Top