Skip to content
Andrew Lambert edited this page Mar 14, 2019 · 19 revisions

PKZip.ZipReader

Class Declaration

 Protected Class ZipReader

Remarks

This class reads a Zip archive. To create a new instance pass a MemoryBlock, BinaryStream, or FolderItem containing the archive to the Constructor method. The archive is processed one entry at a time, from the first entry to the last.

Create a new instance, and access the "Current*" properties to read metadata of the current item in the archive.

Call the MoveNext method to process the current item and then advance the selection to the next item in the archive. MoveNext will return True until an error occurs; note that this includes the end of the archive, so check LastError for details.

Example

This example extracts a single file from an archive:

  Dim zipfile As FolderItem = GetOpenFolderItem("")
  Dim zip As New PKZip.ZipReader(zipfile)
  Dim outputfile As FolderItem = SpecialFolder.Desktop.Child("file.txt")
  Dim output As BinaryStream = BinaryStream.Create(outputfile)
  Do 
    If zip.CurrentName = "path/to/the/file.txt" Then
      Call zip.MoveNext(output)
      Exit Do
    End If
  Loop Until Not zip.MoveNext(Nil)
  output.Close
  zip.Close

Methods

Properties

Shared Methods

Entry-level points of interest denoted by "☜"



Clone this wiki locally