Inherits from NSObject
Declared in ZZArchive.h

Overview

The ZZArchive class represents a zip file for reading only.

Properties

URL

The URL representing this archive.

@property (readonly, nonatomic) NSURL *URL

Declared In

ZZArchive.h

contents

The uninterpreted contents of this archive.

@property (readonly, nonatomic) NSData *contents

Declared In

ZZArchive.h

entries

The array of ZZArchiveEntry entries within this archive.

@property (readonly, nonatomic) NSArray *entries

Declared In

ZZArchive.h

Class Methods

archiveWithContentsOfURL:

Creates a new archive with the zip file at the given file URL.

+ (instancetype)archiveWithContentsOfURL:(NSURL *)URL

Parameters

URL

The file URL of the zip file.

Return Value

The initialized archive. If the zip file does not exist, this will have no entries.

Discussion

The archive will use UTF-8 encoding for reading entry file names and comments.

Declared In

ZZArchive.h

archiveWithData:

Creates a new archive with the raw zip file data given.

+ (instancetype)archiveWithData:(NSData *)data

Parameters

data

The raw data of the zip file

Return Value

The initialized archive.

Discussion

The archive will use UTF-8 encoding for reading entry file names and comments.

Declared In

ZZArchive.h

Instance Methods

initWithContentsOfURL:encoding:

Initializes a new archive with the zip file at the given file URL.

- (id)initWithContentsOfURL:(NSURL *)URL encoding:(NSStringEncoding)encoding

Parameters

URL

The file URL of the zip file.

encoding

The encoding for reading entry file names and comments.

Return Value

The initialized archive. If the zip file does not exist, this will have no entries.

Declared In

ZZArchive.h

initWithData:encoding:

Initializes a new archive with the raw zip file data given.

- (id)initWithData:(NSData *)data encoding:(NSStringEncoding)encoding

Parameters

data

The raw data of the zip file

encoding

The encoding for reading entry file names and comments.

Return Value

The initialized archive.

Declared In

ZZArchive.h

load:

Loads the contents and entries from the source. Any old entries will then be considered invalid.

- (BOOL)load:(NSError **)error

Parameters

error

The error information when an error occurs. Pass in nil if you do not want error information.

Return Value

Whether the load was successful or not.

Discussion

If you access entries or contents, the receiver already automatically loads them if needed. You only need to call this method to force a reload from source, or to check for errors when loading.

Declared In

ZZArchive.h