ZipReader Class

Contains methods to get information about zip entries and to extract content for specified zip entries from the zip file.

Compression

The following are constructors for ZipReader.

  • ZipReader(data)

    Creates a new instance of the ZipReader class using the specified blob data.

Creates a new instance of the ZipReader class using the specified blob data.

global ZipReader(Blob data)

  • data: Type: Blob Apex blob that contains the compressed content.

The following are methods for ZipReader.

  • extract(name)

    Extracts the bytes for the specified zip entry name and decompresses the content.

  • extract(entry)

    Extracts the bytes for the specified zip entry and decompresses the content.

  • getEntries()

    Gets a list of all the entries from the zip file.

  • getEntriesMap()

    Gets a map of names and the corresponding zip entries from the zip file.

  • getEntry(name)

    Gets a zip entry for the specified name from the zip file.

  • getEntryNames()

    Gets a list of all the zip entry names from the zip file.

Extracts the bytes for the specified zip entry name and decompresses the content.

public blob extract(string name)

  • name: Type: string Species the zip entry name to extract and decompress.

Type: blob

Apex blob that contains the decompressed content.

Extracts the bytes for the specified zip entry and decompresses the content.

public blob extract(Compression.ZipEntry entry)

Type: blob

Apex blob that contains the decompressed content.

Gets a list of all the entries from the zip file.

public List<compression.ZipEntry> getEntries()

Type: List<Compression.ZipEntry>

Gets a map of names and the corresponding zip entries from the zip file.

public Map<String,Compression.ZipEntry> getEntriesMap()

Type: Map<string,Compression.ZipEntry>

Gets a zip entry for the specified name from the zip file.

public compression.ZipEntry getEntry(string name)

  • name: Type: string Name of the zip entry.

Type: Compression.ZipEntry

Throws a ZipException if the specified name isn’t found.

Gets a list of all the zip entry names from the zip file.

public List<String> getEntryNames()

Type: List<String>