ZipReader Class

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

Namespace

Compression

ZipReader Constructors

The following are constructors for ZipReader.

ZipReader(data)

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

Signature

global ZipReader(Blob data)

Parameters

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

ZipReader Methods

The following are methods for ZipReader.

extract(name)

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

Signature

public blob extract(string name)

Parameters

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

Return Value

Type: blob

Apex blob that contains the decompressed content.

extract(entry)

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

Signature

public blob extract(Compression.ZipEntry entry)

Parameters

Return Value

Type: blob

Apex blob that contains the decompressed content.

getEntries()

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

Signature

public List<compression.ZipEntry> getEntries()

Return Value

Type: List<Compression.ZipEntry>

getEntriesMap()

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

Signature

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

Return Value

Type: Map<string,Compression.ZipEntry>

getEntry(name)

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

Signature

public compression.ZipEntry getEntry(string name)

Parameters

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

Return Value

Type: Compression.ZipEntry

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

getEntryNames()

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

Signature

public List<String> getEntryNames()

Return Value

Type: List<String>