diff --git a/Objective-Zip Tests/ObjectiveZip_Tests.m b/Objective-Zip Tests/ObjectiveZip_Tests.m index 8f152c9..1901c9e 100644 --- a/Objective-Zip Tests/ObjectiveZip_Tests.m +++ b/Objective-Zip Tests/ObjectiveZip_Tests.m @@ -3,12 +3,38 @@ // Objective-Zip // // Created by Gianluca Bertani on 29/08/15. +// Copyright 2009-2015 Gianluca Bertani. All rights reserved. // +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// * Neither the name of Gianluca Bertani nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. // #import #import "Objective-Zip.h" +#import "Objective-Zip+NSError.h" #define HUGE_TEST_BLOCK_LENGTH (50000LL) #define HUGE_TEST_NUMBER_OF_BLOCKS (100000LL) diff --git a/Objective-Zip.xcodeproj/project.pbxproj b/Objective-Zip.xcodeproj/project.pbxproj index c0f149e..b37a9f4 100755 --- a/Objective-Zip.xcodeproj/project.pbxproj +++ b/Objective-Zip.xcodeproj/project.pbxproj @@ -149,6 +149,13 @@ 8CD8B40017766067005212EC /* zlib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = zlib.h; path = ZLib/zlib.h; sourceTree = ""; }; 8CD8B40117766067005212EC /* zutil.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zutil.c; path = ZLib/zutil.c; sourceTree = ""; }; 8CD8B40217766067005212EC /* zutil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = zutil.h; path = ZLib/zutil.h; sourceTree = ""; }; + 8CFA78221BA097AE001F3C5F /* OZZipFile+Standard.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "OZZipFile+Standard.h"; path = "Objective-Zip/OZZipFile+Standard.h"; sourceTree = ""; }; + 8CFA78231BA097C3001F3C5F /* OZZipFile+NSError.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "OZZipFile+NSError.h"; path = "Objective-Zip/OZZipFile+NSError.h"; sourceTree = ""; }; + 8CFA78241BA098D3001F3C5F /* Objective-Zip+NSError.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "Objective-Zip+NSError.h"; path = "Objective-Zip/Objective-Zip+NSError.h"; sourceTree = ""; }; + 8CFA78251BA0992D001F3C5F /* OZZipWriteStream+Standard.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "OZZipWriteStream+Standard.h"; path = "Objective-Zip/OZZipWriteStream+Standard.h"; sourceTree = ""; }; + 8CFA78261BA0993B001F3C5F /* OZZipWriteStream+NSError.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "OZZipWriteStream+NSError.h"; path = "Objective-Zip/OZZipWriteStream+NSError.h"; sourceTree = ""; }; + 8CFA78271BA0994B001F3C5F /* OZZipReadStream+Standard.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "OZZipReadStream+Standard.h"; path = "Objective-Zip/OZZipReadStream+Standard.h"; sourceTree = ""; }; + 8CFA78281BA0995A001F3C5F /* OZZipReadStream+NSError.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "OZZipReadStream+NSError.h"; path = "Objective-Zip/OZZipReadStream+NSError.h"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -238,7 +245,10 @@ isa = PBXGroup; children = ( 8CC6A7931B8F5B360062D97E /* Objective-Zip.h */, + 8CFA78241BA098D3001F3C5F /* Objective-Zip+NSError.h */, 8C6D353E10E56BD300B63EFA /* OZZipFile.h */, + 8CFA78221BA097AE001F3C5F /* OZZipFile+Standard.h */, + 8CFA78231BA097C3001F3C5F /* OZZipFile+NSError.h */, 8C6D353F10E56BD300B63EFA /* OZZipFile.m */, 8CC6A7941B8F5C370062D97E /* OZZipFileMode.h */, 8CC6A7951B8F5C810062D97E /* OZZipCompressionLevel.h */, @@ -246,12 +256,16 @@ 8CC6A7961B8F5F570062D97E /* OZZipException+Internals.h */, 8C6D356A10E56F4D00B63EFA /* OZZipException.m */, 8C6D357410E5797600B63EFA /* OZZipWriteStream.h */, + 8CFA78251BA0992D001F3C5F /* OZZipWriteStream+Standard.h */, + 8CFA78261BA0993B001F3C5F /* OZZipWriteStream+NSError.h */, 8CC6A7971B8F5F780062D97E /* OZZipWriteStream+Internals.h */, 8C6D357510E5797600B63EFA /* OZZipWriteStream.m */, 8C83F49310E7CBCB002FB3CB /* OZFileInZipInfo.h */, 8CC6A7981B8F5F950062D97E /* OZFileInZipInfo+Internals.h */, 8C83F49410E7CBCB002FB3CB /* OZFileInZipInfo.m */, 8CBE431610E95FA300AC9ED3 /* OZZipReadStream.h */, + 8CFA78271BA0994B001F3C5F /* OZZipReadStream+Standard.h */, + 8CFA78281BA0995A001F3C5F /* OZZipReadStream+NSError.h */, 8CC6A7991B8F5FB40062D97E /* OZZipReadStream+Internals.h */, 8CBE431710E95FA300AC9ED3 /* OZZipReadStream.m */, ); @@ -934,6 +948,7 @@ 8CC2FC6B1B91E63E00D5E05F /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; 8CC2FC6C1B91E63E00D5E05F /* Build configuration list for PBXNativeTarget "Objective-Zip Tests" */ = { isa = XCConfigurationList; @@ -942,6 +957,7 @@ 8CC2FC6E1B91E63E00D5E05F /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; 8CC2FC841B91E65300D5E05F /* Build configuration list for PBXNativeTarget "Objective-Zip OS X" */ = { isa = XCConfigurationList; @@ -950,6 +966,7 @@ 8CC2FC861B91E65300D5E05F /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; 8CC2FC871B91E65300D5E05F /* Build configuration list for PBXNativeTarget "Objective-Zip OS X Tests" */ = { isa = XCConfigurationList; @@ -958,6 +975,7 @@ 8CC2FC891B91E65300D5E05F /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Objective-Zip" */ = { isa = XCConfigurationList; diff --git a/Objective-Zip/OZZipFile+NSError.h b/Objective-Zip/OZZipFile+NSError.h new file mode 100644 index 0000000..056d755 --- /dev/null +++ b/Objective-Zip/OZZipFile+NSError.h @@ -0,0 +1,315 @@ +// +// OZZipFile+NSError.h +// Objective-Zip +// +// Created by Gianluca Bertani on 09/09/15. +// Copyright 2009-2015 Gianluca Bertani. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// * Neither the name of Gianluca Bertani nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#import "OZZipFile.h" + + +@interface OZZipFile (NSError) + + +#pragma mark - +#pragma mark Initialization (NSError variants) + +/** + @brief Creates a OZZipFile with the specified zip file name and access mode. +

The access mode specifies if the zip is being created, appended, or + unzipped.

+

Note: the zip file is opened in 64-bit mode.

+ @param fileName File name of the zip file. + @param mode Access mode, can be:
    +
  • OZZipFileModeUnzip: the zip file is opened for reading. +
  • OZZipFileModeCreate: the zip file is opened for creation. +
    Note: if the file already exists the behavior is unspecified. +
  • OZZipFileModeAppend: the zip file is opened for writing. +
+ @param error If passed, may be filled with an NSError is case the file + can't be opened. + @throws OZZipException If the access mode is invalid. + */ +- (nullable instancetype) initWithFileName:(nonnull NSString *)fileName mode:(OZZipFileMode)mode error:(NSError * __autoreleasing __nullable * __nullable)error; + +/** + @brief Creates a OZZipFile with the specified zip file name, access mode and + legacy 32-bit mode compatibility. +

The access mode specifies if the zip is being created, appended, or + unzipped.

+ @param fileName File name of the zip file. + @param mode Access mode, can be:
    +
  • OZZipFileModeUnzip: the zip file is opened for reading. +
  • OZZipFileModeCreate: the zip file is opened for creation. +
    Note: if the file already exists the behavior is unspecified. +
  • OZZipFileModeAppend: the zip file is opened for writing. +
+ @param legacy32BitMode If set, the zip file is opened in 32-bit mode to + provide compatibility with older operating systems (such as some + version of Android). + @param error If passed, may be filled with an NSError is case the file + can't be opened. + @throws OZZipException If the access mode is invalid. + */ +- (nullable instancetype) initWithFileName:(nonnull NSString *)fileName mode:(OZZipFileMode)mode legacy32BitMode:(BOOL)legacy32BitMode error:(NSError * __autoreleasing __nullable * __nullable)error; + + +#pragma mark - +#pragma mark File writing (NSError variants) + +/** + @brief Creates a new OZZipWriteStream for adding a new file in the zip file + content. +

The returned write stream can be used to write data to the new file.

+

Note: the new file is added with the current date/time.

+ @param fileNameInZip Name of the new file that must be added to the zip file + content. +
Note: to structure the zip file with directories and subdirectories, + ensure to prepend them in the file name, e.g. "docs/html/index.html" + @param compressionLevel The compression level that must be used to compress + the new file added to the zip file content. Can be:
    +
  • OZZipCompressionLevelNone: does not compress the new file, it is stored + as is. +
  • OZZipCompressionLevelFastest: uses the fastest compression level, which + also compresses the least. +
  • OZZipCompressionLevelBest: uses the best compression level, which is also + the slowest. +
  • OZZipCompressionLevelDefault: uses the default compression level, + somewhere inbetween OZZipCompressionLevelBest and + OZZipCompressionLevelFastest. +
+ @param error If passed, may be filled with an NSError is case the write + stream can't be opened. + @return A new OZZipWriteStream for writing data to the new file in the zip + file content, or nil if an error occurs. + @throws OZZipException If the zip file has been opened in unzip mode. + */ +- (nullable OZZipWriteStream *) writeFileInZipWithName:(nonnull NSString *)fileNameInZip compressionLevel:(OZZipCompressionLevel)compressionLevel error:(NSError * __autoreleasing __nullable * __nullable)error; + +/** + @brief Creates a new OZZipWriteStream for adding a new file in the zip file + content. +

The returned write stream can be used to write data to the new file.

+ @param fileNameInZip Name of the new file that must be added to the zip file + content. +
Note: to structure the zip file with directories and subdirectories, + ensure to prepend them in the file name, e.g. "docs/html/index.html" + @param fileDate The date/time of the new file that must be added to the zip + file content. + @param compressionLevel The compression level that must be used to compress + the new file added to the zip file content. Can be:
    +
  • OZZipCompressionLevelNone: does not compress the new file, it is stored + as is. +
  • OZZipCompressionLevelFastest: uses the fastest compression level, which + also compresses the least. +
  • OZZipCompressionLevelBest: uses the best compression level, which is also + the slowest. +
  • OZZipCompressionLevelDefault: uses the default compression level, + somewhere inbetween OZZipCompressionLevelBest and + OZZipCompressionLevelFastest. +
+ @param error If passed, may be filled with an NSError is case the write + stream can't be opened. + @return A new OZZipWriteStream for writing data to the new file in the zip + file content, or nil if an error occurs. + @throws OZZipException If the zip file has been opened in unzip mode. + */ +- (nullable OZZipWriteStream *) writeFileInZipWithName:(nonnull NSString *)fileNameInZip fileDate:(nonnull NSDate *)fileDate compressionLevel:(OZZipCompressionLevel)compressionLevel error:(NSError * __autoreleasing __nullable * __nullable)error; + +/** + @brief Creates a new OZZipWriteStream for adding a new encrypted file in the + zip file content. +

The returned write stream can be used to write data to the new file.

+ @param fileNameInZip Name of the new file that must be added to the zip file + content. +
Note: to structure the zip file with directories and subdirectories, + ensure to prepend them in the file name, e.g. "docs/html/index.html" + @param fileDate The date/time of the new file that must be added to the zip + file content. + @param compressionLevel The compression level that must be used to compress + the new file added to the zip file content. Can be:
    +
  • OZZipCompressionLevelNone: does not compress the new file, it is stored + as is. +
  • OZZipCompressionLevelFastest: uses the fastest compression level, which + also compresses the least. +
  • OZZipCompressionLevelBest: uses the best compression level, which is also + the slowest. +
  • OZZipCompressionLevelDefault: uses the default compression level, + somewhere inbetween OZZipCompressionLevelBest and + OZZipCompressionLevelFastest. +
+ @param password The password that must be used to encrypt the new file data. + @param crc32 A precomputed CRC32 of the new file data (needed for crypting). + @param error If passed, may be filled with an NSError is case the write + stream can't be opened. + @return A new OZZipWriteStream for writing data to the new file in the zip + file content, or nil if an error occurs. + @throws OZZipException If the zip file has been opened in unzip mode. + */ +- (nullable OZZipWriteStream *) writeFileInZipWithName:(nonnull NSString *)fileNameInZip fileDate:(nonnull NSDate *)fileDate compressionLevel:(OZZipCompressionLevel)compressionLevel password:(nonnull NSString *)password crc32:(NSUInteger)crc32 error:(NSError * __autoreleasing __nullable * __nullable)error; + + +#pragma mark - +#pragma mark File seeking and info (NSError variants) + +/** + @brief Moves selection to the first file contained in the zip file. +

The selected file may then be read by obaining a OZZipReadStream with + readCurrentFileInZip.

+ @param error If passed, may be filled with an NSError is case the first file + can't be selected. + @return YES if the first file has been selected, NO + if it could not select the first file due to an error. + @throws OZZipException If the zip file has been opened with a mode other than + Unzip. + */ +- (BOOL) goToFirstFileInZipWithError:(NSError * __autoreleasing __nullable * __nullable)error; + +/** + @brief Moves selection to the next file contained in the zip file. +

The selected file may then be read by obaining a OZZipReadStream with + readCurrentFileInZip.

+ @param error If passed, may be filled with an NSError is case the next file + can't be selected. + @return YES if the next file has been selected, NO + if there were no more files to select in the zip file, or the next file could + not be selected due to an error. + @throws OZZipException If the zip file has been opened with a mode other than + Unzip. + */ +- (BOOL) goToNextFileInZipWithError:(NSError * __autoreleasing __nullable * __nullable)error; + +/** + @brief Locates a file by name in the zip file and selects it. +

The selected file may then be read by obaining a OZZipReadStream with + readCurrentFileInZip.

+ @param error If passed, may be filled with an NSError is case the file can't + be located. + @return YES if the file has been located and selected, + NO if the specified file name is not present in the zip file or + the file could not be located due to an error. + @throws OZZipException If the zip file has been opened with a mode other than + Unzip. + */ +- (BOOL) locateFileInZip:(nonnull NSString *)fileNameInZip error:(NSError * __autoreleasing __nullable * __nullable)error; + +/** + @brief Returns the number of files contained in the zip file. + @param error If passed, may be filled with an NSError is case the number of + files could not be obtained. + @return The number of files contained in the zip file, 0 if the number of + files could not be obtained due to an error. + @throws OZZipException If the zip file has been opened with a mode other + than Unzip. + */ +- (NSUInteger) numFilesInZipWithError:(NSError * __autoreleasing __nullable * __nullable)error; + +/** + @brief Returns a list of OZFileInZipInfo with the information on all the files + contained in the zip file. + @param error If passed, may be filled with an NSError is case the list of + file info could not be obtained. + @return The list of OZFileInZipInfo with the information on all the files + contained in the zip file, nil if the list of file info could + not be obtained due to an error. + @throws OZZipException If the zip file has been opened with a mode other than + Unzip. + */ +- (nullable NSArray *) listFileInZipInfosWithError:(NSError * __autoreleasing __nullable * __nullable)error; + +/** + @brief Returns an OZFileInZipInfo with the information on the currently + selected file in the zip file. + @param error If passed, may be filled with an NSError is case the file info + could not be obtained. + @return An OZFileInZipInfo with the information on the currently + selected file in the zip file, nil if the file info could not be + obtained due to an error. + @throws OZZipException If the zip file has been opened with a mode other than + Unzip. + */ +- (nullable OZFileInZipInfo *) getCurrentFileInZipInfoWithError:(NSError * __autoreleasing __nullable * __nullable)error; + + +#pragma mark - +#pragma mark File reading (NSError variants) + +/** + @brief Creates a OZZipReadStream for reading the currently selected file in + the zip file. +

A file in the zip file can be selected using + goToFirstFileInZip, goToNextFileInZip and + locateFileInZip:.

+ @param error If passed, may be filled with an NSError is case the read stream + could not be created. + @return The OZZipReadStream to be used for reading the currently selected file + in the zip file, nil if the read stream could not be created + due to an error. + @throws OZZipException If the zip file has been opened with a mode other than + Unzip. + */ +- (nullable OZZipReadStream *) readCurrentFileInZipWithError:(NSError * __autoreleasing __nullable * __nullable)error; + +/** + @brief Creates a OZZipReadStream for reading the currently selected file in + the zip file, if it is encrypted. +

A file in the zip file can be selected using + goToFirstFileInZip, goToNextFileInZip and + locateFileInZip:.

+ @param password The password that must be used to decrypt the file data. + @param error If passed, may be filled with an NSError is case the read stream + could not be created. + @return The OZZipReadStream to be used for reading the currently selected file + in the zip file, nil if the read stream could not be created + due to an error. + @throws OZZipException If the zip file has been opened with a mode other than + Unzip. + */ +- (nullable OZZipReadStream *) readCurrentFileInZipWithPassword:(nonnull NSString *)password error:(NSError * __autoreleasing __nullable * __nullable)error; + + +#pragma mark - +#pragma mark Closing (NSError variants) + +/** + @brief Closes the zip file and releases its resources. +

Once you have finished working with the zip file (e.g. all files have been + unzipped, or all files have been added), it is important to close it so system + resources may be freed.

+

Note: after the zip file has been closed any subsequent call will result in an + error.

+ @param error If passed, may be filled with an NSError is case the zip file + could not be closed. + @return YES if the zip file has been closed, NO if + the zip file could not be closed due to an error. + */ +- (BOOL) closeWithError:(NSError * __autoreleasing __nullable * __nullable)error; + + +@end diff --git a/Objective-Zip/OZZipFile+Standard.h b/Objective-Zip/OZZipFile+Standard.h new file mode 100644 index 0000000..5523968 --- /dev/null +++ b/Objective-Zip/OZZipFile+Standard.h @@ -0,0 +1,282 @@ +// +// OZZipFile+Standard.h +// Objective-Zip +// +// Created by Gianluca Bertani on 09/09/15. +// Copyright 2009-2015 Gianluca Bertani. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// * Neither the name of Gianluca Bertani nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#import "OZZipFile.h" + + +@interface OZZipFile (Standard) + + +#pragma mark - +#pragma mark Initialization + +/** + @brief Creates a OZZipFile with the specified zip file name and access mode. +

The access mode specifies if the zip is being created, appended, or + unzipped.

+

Note: the zip file is opened in 64-bit mode.

+ @param fileName File name of the zip file. + @param mode Access mode, can be:
    +
  • OZZipFileModeUnzip: the zip file is opened for reading. +
  • OZZipFileModeCreate: the zip file is opened for creation. +
    Note: if the file already exists the behavior is unspecified. +
  • OZZipFileModeAppend: the zip file is opened for writing. +
+ @throws OZZipException If the file can't be opened due to an erroror if the + access mode is invalid. + */ +- (nonnull instancetype) initWithFileName:(nonnull NSString *)fileName mode:(OZZipFileMode)mode; + +/** + @brief Creates a OZZipFile with the specified zip file name, access mode and + legacy 32-bit mode compatibility. +

The access mode specifies if the zip is being created, appended, or + unzipped.

+ @param fileName File name of the zip file. + @param mode Access mode, can be:
    +
  • OZZipFileModeUnzip: the zip file is opened for reading. +
  • OZZipFileModeCreate: the zip file is opened for creation. +
    Note: if the file already exists the behavior is unspecified. +
  • OZZipFileModeAppend: the zip file is opened for writing. +
+ @param legacy32BitMode If set, the zip file is opened in 32-bit mode to + provide compatibility with older operating systems (such as some + version of Android). + @throws OZZipException If the file can't be opened due to an error or if the + access mode is invalid. + */ +- (nonnull instancetype) initWithFileName:(nonnull NSString *)fileName mode:(OZZipFileMode)mode legacy32BitMode:(BOOL)legacy32BitMode; + + +#pragma mark - +#pragma mark File writing + +/** + @brief Creates a new OZZipWriteStream for adding a new file in the zip file + content. +

The returned write stream can be used to write data to the new file.

+

Note: the new file is added with the current date/time.

+ @param fileNameInZip Name of the new file that must be added to the zip file + content. +
Note: to structure the zip file with directories and subdirectories, + ensure to prepend them in the file name, e.g. "docs/html/index.html" + @param compressionLevel The compression level that must be used to compress + the new file added to the zip file content. Can be:
    +
  • OZZipCompressionLevelNone: does not compress the new file, it is stored + as is. +
  • OZZipCompressionLevelFastest: uses the fastest compression level, which + also compresses the least. +
  • OZZipCompressionLevelBest: uses the best compression level, which is also + the slowest. +
  • OZZipCompressionLevelDefault: uses the default compression level, + somewhere inbetween OZZipCompressionLevelBest and + OZZipCompressionLevelFastest. +
+ @return A new OZZipWriteStream for writing data to the new file in the zip + file content. + @throws OZZipException If the file stream can't be created due to an error or + if the zip file has been opened in unzip mode. + */ +- (nonnull OZZipWriteStream *) writeFileInZipWithName:(nonnull NSString *)fileNameInZip compressionLevel:(OZZipCompressionLevel)compressionLevel; + +/** + @brief Creates a new OZZipWriteStream for adding a new file in the zip file + content. +

The returned write stream can be used to write data to the new file.

+ @param fileNameInZip Name of the new file that must be added to the zip file + content. +
Note: to structure the zip file with directories and subdirectories, + ensure to prepend them in the file name, e.g. "docs/html/index.html" + @param fileDate The date/time of the new file that must be added to the zip + file content. + @param compressionLevel The compression level that must be used to compress + the new file added to the zip file content. Can be:
    +
  • OZZipCompressionLevelNone: does not compress the new file, it is stored + as is. +
  • OZZipCompressionLevelFastest: uses the fastest compression level, which + also compresses the least. +
  • OZZipCompressionLevelBest: uses the best compression level, which is also + the slowest. +
  • OZZipCompressionLevelDefault: uses the default compression level, + somewhere inbetween OZZipCompressionLevelBest and + OZZipCompressionLevelFastest. +
+ @return A new OZZipWriteStream for writing data to the new file in the zip + file content. + @throws OZZipException If the file stream can't be created due to an error or + if the zip file has been opened in unzip mode. + */ +- (nonnull OZZipWriteStream *) writeFileInZipWithName:(nonnull NSString *)fileNameInZip fileDate:(nonnull NSDate *)fileDate compressionLevel:(OZZipCompressionLevel)compressionLevel; + +/** + @brief Creates a new OZZipWriteStream for adding a new encrypted file in the + zip file content. +

The returned write stream can be used to write data to the new file.

+ @param fileNameInZip Name of the new file that must be added to the zip file + content. +
Note: to structure the zip file with directories and subdirectories, + ensure to prepend them in the file name, e.g. "docs/html/index.html" + @param fileDate The date/time of the new file that must be added to the zip + file content. + @param compressionLevel The compression level that must be used to compress + the new file added to the zip file content. Can be:
    +
  • OZZipCompressionLevelNone: does not compress the new file, it is stored + as is. +
  • OZZipCompressionLevelFastest: uses the fastest compression level, which + also compresses the least. +
  • OZZipCompressionLevelBest: uses the best compression level, which is also + the slowest. +
  • OZZipCompressionLevelDefault: uses the default compression level, + somewhere inbetween OZZipCompressionLevelBest and + OZZipCompressionLevelFastest. +
+ @param password The password that must be used to encrypt the new file data. + @param crc32 A precomputed CRC32 of the new file data (needed for crypting). + @return A new OZZipWriteStream for writing data to the new file in the zip + file content. + @throws OZZipException If the file stream can't be created due to an error or + if the zip file has been opened in unzip mode. + */ +- (nonnull OZZipWriteStream *) writeFileInZipWithName:(nonnull NSString *)fileNameInZip fileDate:(nonnull NSDate *)fileDate compressionLevel:(OZZipCompressionLevel)compressionLevel password:(nonnull NSString *)password crc32:(NSUInteger)crc32; + + +#pragma mark - +#pragma mark File seeking and info + +/** + @brief Moves selection to the first file contained in the zip file. +

The selected file may then be read by obaining a OZZipReadStream with + readCurrentFileInZip.

+ @throws OZZipException If the first file can't be selected due to an error or + if the zip file has been opened with a mode other than Unzip. + */ +- (void) goToFirstFileInZip; + +/** + @brief Moves selection to the next file contained in the zip file. +

The selected file may then be read by obaining a OZZipReadStream with + readCurrentFileInZip.

+ @return YES if the next file has been selected, + NO if there were no more files to select in the zip file. + @throws OZZipException If the next file can't be selected due to an error or + if the zip file has been opened with a mode other than Unzip. + */ +- (BOOL) goToNextFileInZip; + +/** + @brief Locates a file by name in the zip file and selects it. +

The selected file may then be read by obaining a OZZipReadStream with + readCurrentFileInZip.

+ @return YES if the file has been located and selected, + NO if the specified file name is not present in the zip file. + @throws OZZipException If the file can't be located due to an error or if the + zip file has been opened with a mode other than Unzip. + */ +- (BOOL) locateFileInZip:(nonnull NSString *)fileNameInZip; + +/** + @brief Returns the number of files contained in the zip file. + @return The number of files contained in the zip file. + @throws OZZipException If the number of files could not be obtained due to an + error or if the zip file has been opened with a mode other than Unzip. + */ +- (NSUInteger) numFilesInZip; + +/** + @brief Returns a list of OZFileInZipInfo with the information on all the files + contained in the zip file. + @return The list of OZFileInZipInfo with the information on all the files + contained in the zip file. + @throws OZZipException If the list of file info could not be obtained due to + an error or if the zip file has been opened with a mode other than Unzip. + */ +- (nonnull NSArray *) listFileInZipInfos; + +/** + @brief Returns an OZFileInZipInfo with the information on the currently + selected file in the zip file. + @return An OZFileInZipInfo with the information on the currently + selected file in the zip file. + @throws OZZipException If the info info could not be obtained due to an error + or if the zip file has been opened with a mode other than Unzip. + */ +- (nonnull OZFileInZipInfo *) getCurrentFileInZipInfo; + + +#pragma mark - +#pragma mark File reading + +/** + @brief Creates a OZZipReadStream for reading the currently selected file in + the zip file. +

A file in the zip file can be selected using + goToFirstFileInZip, goToNextFileInZip and + locateFileInZip:.

+ @return The OZZipReadStream to be used for reading the currently selected file + in the zip file. + @throws OZZipException If the read stream could not be created due to an error + or if the zip file has been opened with a mode other than Unzip. + */ +- (nonnull OZZipReadStream *) readCurrentFileInZip; + +/** + @brief Creates a OZZipReadStream for reading the currently selected file in + the zip file, if it is encrypted. +

A file in the zip file can be selected using + goToFirstFileInZip, goToNextFileInZip and + locateFileInZip:.

+ @param password The password that must be used to decrypt the file data. + @return The OZZipReadStream to be used for reading the currently selected file + in the zip file. + @throws OZZipException If the read stream could not be created due to an error + or if the zip file has been opened with a mode other than Unzip. + */ +- (nonnull OZZipReadStream *) readCurrentFileInZipWithPassword:(nonnull NSString *)password; + + +#pragma mark - +#pragma mark Closing + +/** + @brief Closes the zip file and releases its resources. +

Once you have finished working with the zip file (e.g. all files have been + unzipped, or all files have been added), it is important to close it so system + resources may be freed.

+

Note: after the zip file has been closed any subsequent call will result in an + error.

+ @throws OZZipException If the zip file could not be closed due to an error. + */ +- (void) close; + + +@end diff --git a/Objective-Zip/OZZipFile.h b/Objective-Zip/OZZipFile.h index 50a6ec0..1e3d4d0 100644 --- a/Objective-Zip/OZZipFile.h +++ b/Objective-Zip/OZZipFile.h @@ -56,523 +56,6 @@ @interface OZZipFile : NSObject -#pragma mark - -#pragma mark Initialization - -/** - @brief Creates a OZZipFile with the specified zip file name and access mode. -

The access mode specifies if the zip is being created, appended, or - unzipped.

-

Note: the zip file is opened in 64-bit mode.

- @param fileName File name of the zip file. - @param mode Access mode, can be:
    -
  • OZZipFileModeUnzip: the zip file is opened for reading. -
  • OZZipFileModeCreate: the zip file is opened for creation. -
    Note: if the file already exists the behavior is unspecified. -
  • OZZipFileModeAppend: the zip file is opened for writing. -
- @throws OZZipException If the file can't be opened due to an erroror if the - access mode is invalid. - */ -- (nonnull instancetype) initWithFileName:(nonnull NSString *)fileName mode:(OZZipFileMode)mode; - -/** - @brief Creates a OZZipFile with the specified zip file name, access mode and - legacy 32-bit mode compatibility. -

The access mode specifies if the zip is being created, appended, or - unzipped.

- @param fileName File name of the zip file. - @param mode Access mode, can be:
    -
  • OZZipFileModeUnzip: the zip file is opened for reading. -
  • OZZipFileModeCreate: the zip file is opened for creation. -
    Note: if the file already exists the behavior is unspecified. -
  • OZZipFileModeAppend: the zip file is opened for writing. -
- @param legacy32BitMode If set, the zip file is opened in 32-bit mode to - provide compatibility with older operating systems (such as some - version of Android). - @throws OZZipException If the file can't be opened due to an error or if the - access mode is invalid. - */ -- (nonnull instancetype) initWithFileName:(nonnull NSString *)fileName mode:(OZZipFileMode)mode legacy32BitMode:(BOOL)legacy32BitMode; - - -#pragma mark - -#pragma mark Initialization (NSError variants) - -/** - @brief Creates a OZZipFile with the specified zip file name and access mode. -

The access mode specifies if the zip is being created, appended, or - unzipped.

-

Note: the zip file is opened in 64-bit mode.

- @param fileName File name of the zip file. - @param mode Access mode, can be:
    -
  • OZZipFileModeUnzip: the zip file is opened for reading. -
  • OZZipFileModeCreate: the zip file is opened for creation. -
    Note: if the file already exists the behavior is unspecified. -
  • OZZipFileModeAppend: the zip file is opened for writing. -
- @param error If passed, may be filled with an NSError is case the file - can't be opened. - @throws OZZipException If the access mode is invalid. - */ -- (nullable instancetype) initWithFileName:(nonnull NSString *)fileName mode:(OZZipFileMode)mode error:(NSError * __autoreleasing __nullable * __nullable)error; - -/** - @brief Creates a OZZipFile with the specified zip file name, access mode and - legacy 32-bit mode compatibility. -

The access mode specifies if the zip is being created, appended, or - unzipped.

- @param fileName File name of the zip file. - @param mode Access mode, can be:
    -
  • OZZipFileModeUnzip: the zip file is opened for reading. -
  • OZZipFileModeCreate: the zip file is opened for creation. -
    Note: if the file already exists the behavior is unspecified. -
  • OZZipFileModeAppend: the zip file is opened for writing. -
- @param legacy32BitMode If set, the zip file is opened in 32-bit mode to - provide compatibility with older operating systems (such as some - version of Android). - @param error If passed, may be filled with an NSError is case the file - can't be opened. - @throws OZZipException If the access mode is invalid. - */ -- (nullable instancetype) initWithFileName:(nonnull NSString *)fileName mode:(OZZipFileMode)mode legacy32BitMode:(BOOL)legacy32BitMode error:(NSError * __autoreleasing __nullable * __nullable)error; - - -#pragma mark - -#pragma mark File writing - -/** - @brief Creates a new OZZipWriteStream for adding a new file in the zip file - content. -

The returned write stream can be used to write data to the new file.

-

Note: the new file is added with the current date/time.

- @param fileNameInZip Name of the new file that must be added to the zip file - content. -
Note: to structure the zip file with directories and subdirectories, - ensure to prepend them in the file name, e.g. "docs/html/index.html" - @param compressionLevel The compression level that must be used to compress - the new file added to the zip file content. Can be:
    -
  • OZZipCompressionLevelNone: does not compress the new file, it is stored - as is. -
  • OZZipCompressionLevelFastest: uses the fastest compression level, which - also compresses the least. -
  • OZZipCompressionLevelBest: uses the best compression level, which is also - the slowest. -
  • OZZipCompressionLevelDefault: uses the default compression level, - somewhere inbetween OZZipCompressionLevelBest and - OZZipCompressionLevelFastest. -
- @return A new OZZipWriteStream for writing data to the new file in the zip - file content. - @throws OZZipException If the file stream can't be created due to an error or - if the zip file has been opened in unzip mode. - */ -- (nonnull OZZipWriteStream *) writeFileInZipWithName:(nonnull NSString *)fileNameInZip compressionLevel:(OZZipCompressionLevel)compressionLevel; - -/** - @brief Creates a new OZZipWriteStream for adding a new file in the zip file - content. -

The returned write stream can be used to write data to the new file.

- @param fileNameInZip Name of the new file that must be added to the zip file - content. -
Note: to structure the zip file with directories and subdirectories, - ensure to prepend them in the file name, e.g. "docs/html/index.html" - @param fileDate The date/time of the new file that must be added to the zip - file content. - @param compressionLevel The compression level that must be used to compress - the new file added to the zip file content. Can be:
    -
  • OZZipCompressionLevelNone: does not compress the new file, it is stored - as is. -
  • OZZipCompressionLevelFastest: uses the fastest compression level, which - also compresses the least. -
  • OZZipCompressionLevelBest: uses the best compression level, which is also - the slowest. -
  • OZZipCompressionLevelDefault: uses the default compression level, - somewhere inbetween OZZipCompressionLevelBest and - OZZipCompressionLevelFastest. -
- @return A new OZZipWriteStream for writing data to the new file in the zip - file content. - @throws OZZipException If the file stream can't be created due to an error or - if the zip file has been opened in unzip mode. - */ -- (nonnull OZZipWriteStream *) writeFileInZipWithName:(nonnull NSString *)fileNameInZip fileDate:(nonnull NSDate *)fileDate compressionLevel:(OZZipCompressionLevel)compressionLevel; - -/** - @brief Creates a new OZZipWriteStream for adding a new encrypted file in the - zip file content. -

The returned write stream can be used to write data to the new file.

- @param fileNameInZip Name of the new file that must be added to the zip file - content. -
Note: to structure the zip file with directories and subdirectories, - ensure to prepend them in the file name, e.g. "docs/html/index.html" - @param fileDate The date/time of the new file that must be added to the zip - file content. - @param compressionLevel The compression level that must be used to compress - the new file added to the zip file content. Can be:
    -
  • OZZipCompressionLevelNone: does not compress the new file, it is stored - as is. -
  • OZZipCompressionLevelFastest: uses the fastest compression level, which - also compresses the least. -
  • OZZipCompressionLevelBest: uses the best compression level, which is also - the slowest. -
  • OZZipCompressionLevelDefault: uses the default compression level, - somewhere inbetween OZZipCompressionLevelBest and - OZZipCompressionLevelFastest. -
- @param password The password that must be used to encrypt the new file data. - @param crc32 A precomputed CRC32 of the new file data (needed for crypting). - @return A new OZZipWriteStream for writing data to the new file in the zip - file content. - @throws OZZipException If the file stream can't be created due to an error or - if the zip file has been opened in unzip mode. - */ -- (nonnull OZZipWriteStream *) writeFileInZipWithName:(nonnull NSString *)fileNameInZip fileDate:(nonnull NSDate *)fileDate compressionLevel:(OZZipCompressionLevel)compressionLevel password:(nonnull NSString *)password crc32:(NSUInteger)crc32; - - -#pragma mark - -#pragma mark File writing (NSError variants) - -/** - @brief Creates a new OZZipWriteStream for adding a new file in the zip file - content. -

The returned write stream can be used to write data to the new file.

-

Note: the new file is added with the current date/time.

- @param fileNameInZip Name of the new file that must be added to the zip file - content. -
Note: to structure the zip file with directories and subdirectories, - ensure to prepend them in the file name, e.g. "docs/html/index.html" - @param compressionLevel The compression level that must be used to compress - the new file added to the zip file content. Can be:
    -
  • OZZipCompressionLevelNone: does not compress the new file, it is stored - as is. -
  • OZZipCompressionLevelFastest: uses the fastest compression level, which - also compresses the least. -
  • OZZipCompressionLevelBest: uses the best compression level, which is also - the slowest. -
  • OZZipCompressionLevelDefault: uses the default compression level, - somewhere inbetween OZZipCompressionLevelBest and - OZZipCompressionLevelFastest. -
- @param error If passed, may be filled with an NSError is case the write - stream can't be opened. - @return A new OZZipWriteStream for writing data to the new file in the zip - file content, or nil if an error occurs. - @throws OZZipException If the zip file has been opened in unzip mode. - */ -- (nullable OZZipWriteStream *) writeFileInZipWithName:(nonnull NSString *)fileNameInZip compressionLevel:(OZZipCompressionLevel)compressionLevel error:(NSError * __autoreleasing __nullable * __nullable)error; - -/** - @brief Creates a new OZZipWriteStream for adding a new file in the zip file - content. -

The returned write stream can be used to write data to the new file.

- @param fileNameInZip Name of the new file that must be added to the zip file - content. -
Note: to structure the zip file with directories and subdirectories, - ensure to prepend them in the file name, e.g. "docs/html/index.html" - @param fileDate The date/time of the new file that must be added to the zip - file content. - @param compressionLevel The compression level that must be used to compress - the new file added to the zip file content. Can be:
    -
  • OZZipCompressionLevelNone: does not compress the new file, it is stored - as is. -
  • OZZipCompressionLevelFastest: uses the fastest compression level, which - also compresses the least. -
  • OZZipCompressionLevelBest: uses the best compression level, which is also - the slowest. -
  • OZZipCompressionLevelDefault: uses the default compression level, - somewhere inbetween OZZipCompressionLevelBest and - OZZipCompressionLevelFastest. -
- @param error If passed, may be filled with an NSError is case the write - stream can't be opened. - @return A new OZZipWriteStream for writing data to the new file in the zip - file content, or nil if an error occurs. - @throws OZZipException If the zip file has been opened in unzip mode. - */ -- (nullable OZZipWriteStream *) writeFileInZipWithName:(nonnull NSString *)fileNameInZip fileDate:(nonnull NSDate *)fileDate compressionLevel:(OZZipCompressionLevel)compressionLevel error:(NSError * __autoreleasing __nullable * __nullable)error; - -/** - @brief Creates a new OZZipWriteStream for adding a new encrypted file in the - zip file content. -

The returned write stream can be used to write data to the new file.

- @param fileNameInZip Name of the new file that must be added to the zip file - content. -
Note: to structure the zip file with directories and subdirectories, - ensure to prepend them in the file name, e.g. "docs/html/index.html" - @param fileDate The date/time of the new file that must be added to the zip - file content. - @param compressionLevel The compression level that must be used to compress - the new file added to the zip file content. Can be:
    -
  • OZZipCompressionLevelNone: does not compress the new file, it is stored - as is. -
  • OZZipCompressionLevelFastest: uses the fastest compression level, which - also compresses the least. -
  • OZZipCompressionLevelBest: uses the best compression level, which is also - the slowest. -
  • OZZipCompressionLevelDefault: uses the default compression level, - somewhere inbetween OZZipCompressionLevelBest and - OZZipCompressionLevelFastest. -
- @param password The password that must be used to encrypt the new file data. - @param crc32 A precomputed CRC32 of the new file data (needed for crypting). - @param error If passed, may be filled with an NSError is case the write - stream can't be opened. - @return A new OZZipWriteStream for writing data to the new file in the zip - file content, or nil if an error occurs. - @throws OZZipException If the zip file has been opened in unzip mode. - */ -- (nullable OZZipWriteStream *) writeFileInZipWithName:(nonnull NSString *)fileNameInZip fileDate:(nonnull NSDate *)fileDate compressionLevel:(OZZipCompressionLevel)compressionLevel password:(nonnull NSString *)password crc32:(NSUInteger)crc32 error:(NSError * __autoreleasing __nullable * __nullable)error; - - -#pragma mark - -#pragma mark File seeking and info - -/** - @brief Moves selection to the first file contained in the zip file. -

The selected file may then be read by obaining a OZZipReadStream with - readCurrentFileInZip.

- @throws OZZipException If the first file can't be selected due to an error or - if the zip file has been opened with a mode other than Unzip. - */ -- (void) goToFirstFileInZip; - -/** - @brief Moves selection to the next file contained in the zip file. -

The selected file may then be read by obaining a OZZipReadStream with - readCurrentFileInZip.

- @return YES if the next file has been selected, - NO if there were no more files to select in the zip file. - @throws OZZipException If the next file can't be selected due to an error or - if the zip file has been opened with a mode other than Unzip. - */ -- (BOOL) goToNextFileInZip; - -/** - @brief Locates a file by name in the zip file and selects it. -

The selected file may then be read by obaining a OZZipReadStream with - readCurrentFileInZip.

- @return YES if the file has been located and selected, - NO if the specified file name is not present in the zip file. - @throws OZZipException If the file can't be located due to an error or if the - zip file has been opened with a mode other than Unzip. - */ -- (BOOL) locateFileInZip:(nonnull NSString *)fileNameInZip; - -/** - @brief Returns the number of files contained in the zip file. - @return The number of files contained in the zip file. - @throws OZZipException If the number of files could not be obtained due to an - error or if the zip file has been opened with a mode other than Unzip. - */ -- (NSUInteger) numFilesInZip; - -/** - @brief Returns a list of OZFileInZipInfo with the information on all the files - contained in the zip file. - @return The list of OZFileInZipInfo with the information on all the files - contained in the zip file. - @throws OZZipException If the list of file info could not be obtained due to - an error or if the zip file has been opened with a mode other than Unzip. - */ -- (nonnull NSArray *) listFileInZipInfos; - -/** - @brief Returns an OZFileInZipInfo with the information on the currently - selected file in the zip file. - @return An OZFileInZipInfo with the information on the currently - selected file in the zip file. - @throws OZZipException If the info info could not be obtained due to an error - or if the zip file has been opened with a mode other than Unzip. - */ -- (nonnull OZFileInZipInfo *) getCurrentFileInZipInfo; - - -#pragma mark - -#pragma mark File seeking and info (NSError variants) - -/** - @brief Moves selection to the first file contained in the zip file. -

The selected file may then be read by obaining a OZZipReadStream with - readCurrentFileInZip.

- @param error If passed, may be filled with an NSError is case the first file - can't be selected. - @return YES if the first file has been selected, NO - if it could not select the first file due to an error. - @throws OZZipException If the zip file has been opened with a mode other than - Unzip. - */ -- (BOOL) goToFirstFileInZipWithError:(NSError * __autoreleasing __nullable * __nullable)error; - -/** - @brief Moves selection to the next file contained in the zip file. -

The selected file may then be read by obaining a OZZipReadStream with - readCurrentFileInZip.

- @param error If passed, may be filled with an NSError is case the next file - can't be selected. - @return YES if the next file has been selected, NO - if there were no more files to select in the zip file, or the next file could - not be selected due to an error. - @throws OZZipException If the zip file has been opened with a mode other than - Unzip. - */ -- (BOOL) goToNextFileInZipWithError:(NSError * __autoreleasing __nullable * __nullable)error; - -/** - @brief Locates a file by name in the zip file and selects it. -

The selected file may then be read by obaining a OZZipReadStream with - readCurrentFileInZip.

- @param error If passed, may be filled with an NSError is case the file can't - be located. - @return YES if the file has been located and selected, - NO if the specified file name is not present in the zip file or - the file could not be located due to an error. - @throws OZZipException If the zip file has been opened with a mode other than - Unzip. - */ -- (BOOL) locateFileInZip:(nonnull NSString *)fileNameInZip error:(NSError * __autoreleasing __nullable * __nullable)error; - -/** - @brief Returns the number of files contained in the zip file. - @param error If passed, may be filled with an NSError is case the number of - files could not be obtained. - @return The number of files contained in the zip file, 0 if the number of - files could not be obtained due to an error. - @throws OZZipException If the zip file has been opened with a mode other - than Unzip. - */ -- (NSUInteger) numFilesInZipWithError:(NSError * __autoreleasing __nullable * __nullable)error; - -/** - @brief Returns a list of OZFileInZipInfo with the information on all the files - contained in the zip file. - @param error If passed, may be filled with an NSError is case the list of - file info could not be obtained. - @return The list of OZFileInZipInfo with the information on all the files - contained in the zip file, nil if the list of file info could - not be obtained due to an error. - @throws OZZipException If the zip file has been opened with a mode other than - Unzip. - */ -- (nullable NSArray *) listFileInZipInfosWithError:(NSError * __autoreleasing __nullable * __nullable)error; - -/** - @brief Returns an OZFileInZipInfo with the information on the currently - selected file in the zip file. - @param error If passed, may be filled with an NSError is case the file info - could not be obtained. - @return An OZFileInZipInfo with the information on the currently - selected file in the zip file, nil if the file info could not be - obtained due to an error. - @throws OZZipException If the zip file has been opened with a mode other than - Unzip. - */ -- (nullable OZFileInZipInfo *) getCurrentFileInZipInfoWithError:(NSError * __autoreleasing __nullable * __nullable)error; - - -#pragma mark - -#pragma mark File reading - -/** - @brief Creates a OZZipReadStream for reading the currently selected file in - the zip file. -

A file in the zip file can be selected using - goToFirstFileInZip, goToNextFileInZip and - locateFileInZip:.

- @return The OZZipReadStream to be used for reading the currently selected file - in the zip file. - @throws OZZipException If the read stream could not be created due to an error - or if the zip file has been opened with a mode other than Unzip. - */ -- (nonnull OZZipReadStream *) readCurrentFileInZip; - -/** - @brief Creates a OZZipReadStream for reading the currently selected file in - the zip file, if it is encrypted. -

A file in the zip file can be selected using - goToFirstFileInZip, goToNextFileInZip and - locateFileInZip:.

- @param password The password that must be used to decrypt the file data. - @return The OZZipReadStream to be used for reading the currently selected file - in the zip file. - @throws OZZipException If the read stream could not be created due to an error - or if the zip file has been opened with a mode other than Unzip. - */ -- (nonnull OZZipReadStream *) readCurrentFileInZipWithPassword:(nonnull NSString *)password; - - -#pragma mark - -#pragma mark File reading (NSError variants) - -/** - @brief Creates a OZZipReadStream for reading the currently selected file in - the zip file. -

A file in the zip file can be selected using - goToFirstFileInZip, goToNextFileInZip and - locateFileInZip:.

- @param error If passed, may be filled with an NSError is case the read stream - could not be created. - @return The OZZipReadStream to be used for reading the currently selected file - in the zip file, nil if the read stream could not be created - due to an error. - @throws OZZipException If the zip file has been opened with a mode other than - Unzip. - */ -- (nullable OZZipReadStream *) readCurrentFileInZipWithError:(NSError * __autoreleasing __nullable * __nullable)error; - -/** - @brief Creates a OZZipReadStream for reading the currently selected file in - the zip file, if it is encrypted. -

A file in the zip file can be selected using - goToFirstFileInZip, goToNextFileInZip and - locateFileInZip:.

- @param password The password that must be used to decrypt the file data. - @param error If passed, may be filled with an NSError is case the read stream - could not be created. - @return The OZZipReadStream to be used for reading the currently selected file - in the zip file, nil if the read stream could not be created - due to an error. - @throws OZZipException If the zip file has been opened with a mode other than - Unzip. - */ -- (nullable OZZipReadStream *) readCurrentFileInZipWithPassword:(nonnull NSString *)password error:(NSError * __autoreleasing __nullable * __nullable)error; - - -#pragma mark - -#pragma mark Closing - -/** - @brief Closes the zip file and releases its resources. -

Once you have finished working with the zip file (e.g. all files have been - unzipped, or all files have been added), it is important to close it so system - resources may be freed.

-

Note: after the zip file has been closed any subsequent call will result in an - error.

- @throws OZZipException If the zip file could not be closed due to an error. - */ -- (void) close; - - -#pragma mark - -#pragma mark Closing (NSError variants) - -/** - @brief Closes the zip file and releases its resources. -

Once you have finished working with the zip file (e.g. all files have been - unzipped, or all files have been added), it is important to close it so system - resources may be freed.

-

Note: after the zip file has been closed any subsequent call will result in an - error.

- @param error If passed, may be filled with an NSError is case the zip file - could not be closed. - @return YES if the zip file has been closed, NO if - the zip file could not be closed due to an error. - */ -- (BOOL) closeWithError:(NSError * __autoreleasing __nullable * __nullable)error; - - #pragma mark - #pragma mark Properties diff --git a/Objective-Zip/OZZipFile.m b/Objective-Zip/OZZipFile.m index 7efdfcd..50a7b94 100644 --- a/Objective-Zip/OZZipFile.m +++ b/Objective-Zip/OZZipFile.m @@ -32,11 +32,17 @@ // #import "OZZipFile.h" +#import "OZZipFile+Standard.h" +#import "OZZipFile+NSError.h" #import "OZZipException.h" #import "OZZipException+Internals.h" #import "OZZipReadStream.h" +#import "OZZipReadStream+Standard.h" +#import "OZZipReadStream+NSError.h" #import "OZZipReadStream+Internals.h" #import "OZZipWriteStream.h" +#import "OZZipWriteStream+Standard.h" +#import "OZZipWriteStream+NSError.h" #import "OZZipWriteStream+Internals.h" #import "OZFileInZipInfo.h" #import "OZFileInZipInfo+Internals.h" diff --git a/Objective-Zip/OZZipReadStream+NSError.h b/Objective-Zip/OZZipReadStream+NSError.h new file mode 100644 index 0000000..4bf501b --- /dev/null +++ b/Objective-Zip/OZZipReadStream+NSError.h @@ -0,0 +1,68 @@ +// +// OZZipReadStream+NSError.h +// Objective-Zip +// +// Created by Gianluca Bertani on 09/09/15. +// Copyright 2009-2015 Gianluca Bertani. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// * Neither the name of Gianluca Bertani nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#import "OZZipReadStream.h" + + +@interface OZZipReadStream (NSError) + + +#pragma mark - +#pragma mark Reading data (NSError variants) + +/** + @brief Reads and uncompresses data from the file in the zip file and stores + them in the specified buffer. + @param buffer The buffer where read and uncompressed data must be stored. + @param error If passed, may be filled with an NSError is case data could + not be read. + @return The number of uncompressed bytes read, 0 if the end of + the file has been reached or data could not be read due to an error. + */ +- (NSUInteger) readDataWithBuffer:(nonnull NSMutableData *)buffer error:(NSError * __autoreleasing __nullable * __nullable)error; + +/** + @brief Closes the read steam. +

Once you have finished read data to the file, it is important to close + the stream so system resources may be freed.

+

Note: after the stream has been closed any subsequent read will result in + an error.

+ @param error If passed, may be filled with an NSError is case the stream could + not be closed. + @return YES if the stream has been closed, NO if + the stream could not be closed due to an error. + */ +- (BOOL) finishedReadingWithError:(NSError * __autoreleasing __nullable * __nullable)error; + + +@end diff --git a/Objective-Zip/OZZipReadStream+Standard.h b/Objective-Zip/OZZipReadStream+Standard.h new file mode 100644 index 0000000..ca08845 --- /dev/null +++ b/Objective-Zip/OZZipReadStream+Standard.h @@ -0,0 +1,64 @@ +// +// OZZipReadStream+Standard.h +// Objective-Zip +// +// Created by Gianluca Bertani on 09/09/15. +// Copyright 2009-2015 Gianluca Bertani. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// * Neither the name of Gianluca Bertani nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#import "OZZipReadStream.h" + + +@interface OZZipReadStream (Standard) + + +#pragma mark - +#pragma mark Reading data + +/** + @brief Reads and uncompresses data from the file in the zip file and stores + them in the specified buffer. + @param buffer The buffer where read and uncompressed data must be stored. + @return The number of uncompressed bytes read, 0 if the end of + the file has been reached. + @throws OZZipException If the data could not be read due to an error. + */ +- (NSUInteger) readDataWithBuffer:(nonnull NSMutableData *)buffer; + +/** + @brief Closes the read steam. +

Once you have finished read data to the file, it is important to close + the stream so system resources may be freed.

+

Note: after the stream has been closed any subsequent read will result in + an error.

+ @throws OZZipException If the stream could not be closed due to an error. + */ +- (void) finishedReading; + + +@end diff --git a/Objective-Zip/OZZipReadStream.h b/Objective-Zip/OZZipReadStream.h index 231d84e..cf0e1fc 100644 --- a/Objective-Zip/OZZipReadStream.h +++ b/Objective-Zip/OZZipReadStream.h @@ -41,56 +41,4 @@ @interface OZZipReadStream : NSObject -#pragma mark - -#pragma mark Reading data - -/** - @brief Reads and uncompresses data from the file in the zip file and stores - them in the specified buffer. - @param buffer The buffer where read and uncompressed data must be stored. - @return The number of uncompressed bytes read, 0 if the end of - the file has been reached. - @throws OZZipException If the data could not be read due to an error. - */ -- (NSUInteger) readDataWithBuffer:(nonnull NSMutableData *)buffer; - -/** - @brief Closes the read steam. -

Once you have finished read data to the file, it is important to close - the stream so system resources may be freed.

-

Note: after the stream has been closed any subsequent read will result in - an error.

- @throws OZZipException If the stream could not be closed due to an error. - */ -- (void) finishedReading; - - -#pragma mark - -#pragma mark Reading data (NSError variants) - -/** - @brief Reads and uncompresses data from the file in the zip file and stores - them in the specified buffer. - @param buffer The buffer where read and uncompressed data must be stored. - @param error If passed, may be filled with an NSError is case data could - not be read. - @return The number of uncompressed bytes read, 0 if the end of - the file has been reached or data could not be read due to an error. - */ -- (NSUInteger) readDataWithBuffer:(nonnull NSMutableData *)buffer error:(NSError * __autoreleasing __nullable * __nullable)error; - -/** - @brief Closes the read steam. -

Once you have finished read data to the file, it is important to close - the stream so system resources may be freed.

-

Note: after the stream has been closed any subsequent read will result in - an error.

- @param error If passed, may be filled with an NSError is case the stream could - not be closed. - @return YES if the stream has been closed, NO if - the stream could not be closed due to an error. - */ -- (BOOL) finishedReadingWithError:(NSError * __autoreleasing __nullable * __nullable)error; - - @end diff --git a/Objective-Zip/OZZipReadStream.m b/Objective-Zip/OZZipReadStream.m index 228cde5..138dbc7 100644 --- a/Objective-Zip/OZZipReadStream.m +++ b/Objective-Zip/OZZipReadStream.m @@ -32,6 +32,8 @@ // #import "OZZipReadStream.h" +#import "OZZipReadStream+Standard.h" +#import "OZZipReadStream+NSError.h" #import "OZZipReadStream+Internals.h" #import "OZZipException.h" #import "OZZipException+Internals.h" diff --git a/Objective-Zip/OZZipWriteStream+NSError.h b/Objective-Zip/OZZipWriteStream+NSError.h new file mode 100644 index 0000000..bfea5f9 --- /dev/null +++ b/Objective-Zip/OZZipWriteStream+NSError.h @@ -0,0 +1,67 @@ +// +// OZZipWriteStream+NSError.h +// Objective-Zip +// +// Created by Gianluca Bertani on 09/09/15. +// Copyright 2009-2015 Gianluca Bertani. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// * Neither the name of Gianluca Bertani nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#import "OZZipWriteStream.h" + + +@interface OZZipWriteStream (NSError) + + +#pragma mark - +#pragma mark Writing data (NSError variants) + +/** + @brief Compresses and writes data to the new file in the zip file. +

Data are compressed depending on the choice of compression level specified + during creation of the write stream.

+ @param data The data to be compressed and written. + @param error If passed, may be filled with an NSError is case data could + not be written. + */ +- (BOOL) writeData:(nonnull NSData *)data error:(NSError * __autoreleasing __nullable * __nullable)error; + +/** + @brief Closes the write stream. +

Once you have finished writing data to the new file, it is important to + close the stream so system resources may be freed.

+

Note: after the stream has been closed any subsequent write will result in + an error.

+ @param error If passed, may be filled with an NSError is case the stream could + not be closed. + @return YES if the stream has been closed, NO if + the stream could not be closed due to an error. + */ +- (BOOL) finishedWritingWithError:(NSError * __autoreleasing __nullable * __nullable)error; + + +@end diff --git a/Objective-Zip/OZZipWriteStream+Standard.h b/Objective-Zip/OZZipWriteStream+Standard.h new file mode 100644 index 0000000..d0c44a2 --- /dev/null +++ b/Objective-Zip/OZZipWriteStream+Standard.h @@ -0,0 +1,63 @@ +// +// OZZipWriteStream+Standard.h +// Objective-Zip +// +// Created by Gianluca Bertani on 09/09/15. +// Copyright 2009-2015 Gianluca Bertani. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// * Neither the name of Gianluca Bertani nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#import "OZZipWriteStream.h" + + +@interface OZZipWriteStream (Standard) + + +#pragma mark - +#pragma mark Writing data + +/** + @brief Compresses and writes data to the new file in the zip file. +

Data are compressed depending on the choice of compression level specified + during creation of the write stream.

+ @param data The data to be compressed and written. + @throws OZZipException If the data could not be written due to an error. + */ +- (void) writeData:(nonnull NSData *)data; + +/** + @brief Closes the write stream. +

Once you have finished writing data to the new file, it is important to + close the stream so system resources may be freed.

+

Note: after the stream has been closed any subsequent write will result in + an error.

+ @throws OZZipException If the stream could not be closed due to an error. + */ +- (void) finishedWriting; + + +@end diff --git a/Objective-Zip/OZZipWriteStream.h b/Objective-Zip/OZZipWriteStream.h index a99d1f3..2bd402b 100644 --- a/Objective-Zip/OZZipWriteStream.h +++ b/Objective-Zip/OZZipWriteStream.h @@ -41,54 +41,4 @@ @interface OZZipWriteStream : NSObject -#pragma mark - -#pragma mark Writing data - -/** - @brief Compresses and writes data to the new file in the zip file. -

Data are compressed depending on the choice of compression level specified - during creation of the write stream.

- @param data The data to be compressed and written. - @throws OZZipException If the data could not be written due to an error. - */ -- (void) writeData:(nonnull NSData *)data; - -/** - @brief Closes the write stream. -

Once you have finished writing data to the new file, it is important to - close the stream so system resources may be freed.

-

Note: after the stream has been closed any subsequent write will result in - an error.

- @throws OZZipException If the stream could not be closed due to an error. - */ -- (void) finishedWriting; - - -#pragma mark - -#pragma mark Writing data (NSError variants) - -/** - @brief Compresses and writes data to the new file in the zip file. -

Data are compressed depending on the choice of compression level specified - during creation of the write stream.

- @param data The data to be compressed and written. - @param error If passed, may be filled with an NSError is case data could - not be written. - */ -- (BOOL) writeData:(nonnull NSData *)data error:(NSError * __autoreleasing __nullable * __nullable)error; - -/** - @brief Closes the write stream. -

Once you have finished writing data to the new file, it is important to - close the stream so system resources may be freed.

-

Note: after the stream has been closed any subsequent write will result in - an error.

- @param error If passed, may be filled with an NSError is case the stream could - not be closed. - @return YES if the stream has been closed, NO if - the stream could not be closed due to an error. - */ -- (BOOL) finishedWritingWithError:(NSError * __autoreleasing __nullable * __nullable)error; - - @end diff --git a/Objective-Zip/OZZipWriteStream.m b/Objective-Zip/OZZipWriteStream.m index c4f788b..7810019 100644 --- a/Objective-Zip/OZZipWriteStream.m +++ b/Objective-Zip/OZZipWriteStream.m @@ -32,6 +32,8 @@ // #import "OZZipWriteStream.h" +#import "OZZipWriteStream+Standard.h" +#import "OZZipWriteStream+NSError.h" #import "OZZipWriteStream+Internals.h" #import "OZZipException.h" #import "OZZipException+Internals.h" diff --git a/Objective-Zip/Objective-Zip+NSError.h b/Objective-Zip/Objective-Zip+NSError.h new file mode 100644 index 0000000..201883e --- /dev/null +++ b/Objective-Zip/Objective-Zip+NSError.h @@ -0,0 +1,43 @@ +// +// Objective-Zip+NSError.h +// Objective-Zip +// +// Created by Gianluca Bertani on 09/09/15. +// Copyright 2009-2015 Gianluca Bertani. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// * Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// * Neither the name of Gianluca Bertani nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#import "OZZipFile.h" +#import "OZZipFile+NSError.h" +#import "OZZipFileMode.h" +#import "OZZipCompressionLevel.h" +#import "OZZipException.h" +#import "OZZipWriteStream.h" +#import "OZZipWriteStream+NSError.h" +#import "OZZipReadStream.h" +#import "OZZipReadStream+NSError.h" +#import "OZFileInZipInfo.h" diff --git a/Objective-Zip/Objective-Zip.h b/Objective-Zip/Objective-Zip.h index b0958a5..a874e79 100644 --- a/Objective-Zip/Objective-Zip.h +++ b/Objective-Zip/Objective-Zip.h @@ -32,9 +32,12 @@ // #import "OZZipFile.h" +#import "OZZipFile+Standard.h" #import "OZZipFileMode.h" #import "OZZipCompressionLevel.h" #import "OZZipException.h" #import "OZZipWriteStream.h" +#import "OZZipWriteStream+Standard.h" #import "OZZipReadStream.h" +#import "OZZipReadStream+Standard.h" #import "OZFileInZipInfo.h"