Inherits from NSObject
Declared in ZZArchiveEntry.h

Overview

The ZZArchiveEntry class represents an entry in the ZZArchive or ZZMutableArchive zip file.

Properties

compressed

Whether the entry is compressed.

@property (readonly, nonatomic) BOOL compressed

Declared In

ZZArchiveEntry.h

compressedSize

The compressed size of the entry file: 0 for new entries.

@property (readonly, nonatomic) NSUInteger compressedSize

Declared In

ZZArchiveEntry.h

crc32

The CRC32 code of the entry file: 0 for new entries.

@property (readonly, nonatomic) NSUInteger crc32

Declared In

ZZArchiveEntry.h

fileMode

The UNIX file mode for the entry: 0 for new or non-UNIX entries. This includes the file type bits.

@property (readonly, nonatomic) mode_t fileMode

Declared In

ZZArchiveEntry.h

fileName

The file name of the entry.

@property (readonly, nonatomic) NSString *fileName

Declared In

ZZArchiveEntry.h

lastModified

The last modified date and time of the entry. The time value is only accurate to 2 seconds.

@property (readonly, nonatomic) NSDate *lastModified

Declared In

ZZArchiveEntry.h

uncompressedSize

The uncompressed size of the entry file: 0 for new entries.

@property (readonly, nonatomic) NSUInteger uncompressedSize

Declared In

ZZArchiveEntry.h

Class Methods

archiveEntryWithDirectoryName:

Creates a new directory entry.

+ (instancetype)archiveEntryWithDirectoryName:(NSString *)directoryName

Parameters

directoryName

The directory name for the entry.

Return Value

The created entry.

Declared In

ZZArchiveEntry.h

archiveEntryWithFileName:compress:dataBlock:

Creates a new file entry from a data callback.

+ (instancetype)archiveEntryWithFileName:(NSString *)fileName compress:(BOOL)compress dataBlock:(NSData *( ^ ) ( NSError **error ))dataBlock

Parameters

fileName

The file name for the entry.

compress

Whether to compress the entry.

dataBlock

The callback to return the entry’s data. Returns nil if the write was considered unsuccessful.

Return Value

The created entry.

Declared In

ZZArchiveEntry.h

archiveEntryWithFileName:compress:dataConsumerBlock:

Creates a new file entry from a data-consuming callback.

+ (instancetype)archiveEntryWithFileName:(NSString *)fileName compress:(BOOL)compress dataConsumerBlock:(BOOL ( ^ ) ( CGDataConsumerRef dataConsumer , NSError **error ))dataConsumerBlock

Parameters

fileName

The file name for the entry.

compress

Whether to compress the entry.

dataConsumerBlock

The callback to put the entry’s data into the data consumer. Returns whether the write was considered successful.

Return Value

The created entry.

Declared In

ZZArchiveEntry.h

archiveEntryWithFileName:compress:streamBlock:

Creates a new file entry from a streaming callback.

+ (instancetype)archiveEntryWithFileName:(NSString *)fileName compress:(BOOL)compress streamBlock:(BOOL ( ^ ) ( NSOutputStream *stream , NSError **error ))streamBlock

Parameters

fileName

The file name for the entry.

compress

Whether to compress the entry.

streamBlock

The callback to write the entry’s data to the stream. Returns whether the write was considered successful.

Return Value

The created entry.

Declared In

ZZArchiveEntry.h

archiveEntryWithFileName:fileMode:lastModified:compressionLevel:dataBlock:streamBlock:dataConsumerBlock:

Creates a new entry.

+ (instancetype)archiveEntryWithFileName:(NSString *)fileName fileMode:(mode_t)fileMode lastModified:(NSDate *)lastModified compressionLevel:(NSInteger)compressionLevel dataBlock:(NSData *( ^ ) ( NSError **error ))dataBlock streamBlock:(BOOL ( ^ ) ( NSOutputStream *stream , NSError **error ))streamBlock dataConsumerBlock:(BOOL ( ^ ) ( CGDataConsumerRef dataConsumer , NSError **error ))dataConsumerBlock

Parameters

fileName

The file name for the entry.

fileMode

The UNIX file mode for the entry. This includes the file type bits.

lastModified

The last modified date and time for the entry. The time value is only accurate to 2 seconds.

compressionLevel

The compression level for the entry: 0 for stored, -1 for default deflate, 1 - 9 for custom deflate levels.

dataBlock

The callback that returns the entry file data. Returns nil if the write was considered unsuccessful.

streamBlock

The callback that writes the entry file to the stream. Returns whether the write was considered successful.

dataConsumerBlock

The callback that writes the entry file to the data consumer. Returns whether the write was considered successful.

Return Value

The created entry.

Discussion

The archive entry will choose the first non-nil dataBlock, streamBlock and dataConsumerBlock to supply its data.

Declared In

ZZArchiveEntry.h

Instance Methods

check:

Checks whether the entry file is consistent.

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

Parameters

error

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

Return Value

Whether entry file is consistent or not.

Discussion

Checks whether the local file entry is consistent with the central file entry and also that the recorded and actual checksums of the data agree.

Declared In

ZZArchiveEntry.h

newData

Creates data to represent the entry file.

- (NSData *)newData

Return Value

The new data: nil for new entries.

Declared In

ZZArchiveEntry.h

newDataProvider

Creates a data provider to represent the entry file.

- (CGDataProviderRef)newDataProvider

Return Value

The new data provider: nil for new entries.

Declared In

ZZArchiveEntry.h

newStream

Creates a stream to represent the entry file.

- (NSInputStream *)newStream

Return Value

The new stream: nil for new entries.

Declared In

ZZArchiveEntry.h