diff --git a/.jazzy.yaml b/.jazzy.yaml
index f068898f..7521aca4 100644
--- a/.jazzy.yaml
+++ b/.jazzy.yaml
@@ -4,9 +4,9 @@ exclude: Tests/
swift_version: 3.0.2
author: Timofey Solomko
module: SWCompression
-module_version: 2.0.1
+module_version: 2.1.0
copyright: '© 2017 Timofey Solomko'
readme: README.md
github_url: https://github.com/tsolomko/SWCompression
-github_file_prefix: https://github.com/tsolomko/SWCompression/tree/v2.0.1
+github_file_prefix: https://github.com/tsolomko/SWCompression/tree/v2.1.0
theme: fullwidth
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fa04b739..25a70c8a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,10 @@
# Changelog
+v2.1.0
+----------------
+- ZIP containers support.
+- HuffmanTree is no longer part of SWCompression/Common.
+- Updated documentation.
+
v2.0.1
----------------
- Fixed incorrect reading adler32 checksum from zlib archives.
diff --git a/README.md b/README.md
index 27ed9957..e843ca1f 100644
--- a/README.md
+++ b/README.md
@@ -26,6 +26,8 @@ And here comes SWCompression: no Objective-C, pure Swift.
Features
----------------
+- Containers:
+ - ZIP (complying to ISO/IEC 21320 standard)
- (De)compression algorithms:
- LZMA/LZMA2
- Deflate
@@ -159,7 +161,6 @@ To sum up, it is __highly recommended__ to build SWCompression with 'Release' co
Future plans
-------------
-- ZIP (mostly according to ISO/IEC 21320 standard).
- Tar unarchiving.
- Deflate compression.
- BZip2 compression.
@@ -174,3 +175,6 @@ References
- [LZMA SDK and specification](http://www.7-zip.org/sdk.html)
- [XZ specification](http://tukaani.org/xz/xz-file-format-1.0.4.txt)
- [Wikipedia article about LZMA](https://en.wikipedia.org/wiki/Lempel–Ziv–Markov_chain_algorithm)
+- [.ZIP Application Note](http://www.pkware.com/appnote)
+- [ISO/IEC 21320-1](http://www.iso.org/iso/catalogue_detail.htm?csnumber=60101)
+- [List of defined ZIP extra fields](https://opensource.apple.com/source/zip/zip-6/unzip/unzip/proginfo/extra.fld)
diff --git a/SWCompression.podspec b/SWCompression.podspec
index e9139913..8a605549 100644
--- a/SWCompression.podspec
+++ b/SWCompression.podspec
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|
s.name = "SWCompression"
- s.version = "2.0.1"
+ s.version = "2.1.0"
s.summary = "Framework with implementations in Swift of different (de)compression algorithms"
s.description = <<-DESC
@@ -29,12 +29,12 @@ Pod::Spec.new do |s|
# It should not be included directly in Podfile.
s.subspec 'Common' do |sp|
sp.public_header_files = 'Sources/Service/SWCompression.h'
- sp.source_files = "Sources/{CheckSums.swift,DataWithPointer.swift,Extensions.swift,HuffmanTree.swift,Protocols.swift,Service/*.swift,Service/*.h}"
+ sp.source_files = "Sources/{CheckSums.swift,DataWithPointer.swift,Extensions.swift,Protocols.swift,Service/*.swift,Service/*.h}"
end
s.subspec 'Deflate' do |sp|
sp.dependency 'SWCompression/Common'
- sp.source_files = 'Sources/Deflate.swift'
+ sp.source_files = 'Sources/{Deflate.swift,HuffmanTree.swift}'
end
s.subspec 'GZip' do |sp|
@@ -51,7 +51,7 @@ Pod::Spec.new do |s|
s.subspec 'BZip2' do |sp|
sp.dependency 'SWCompression/Common'
- sp.source_files = 'Sources/BZip2.swift'
+ sp.source_files = 'Sources/{BZip2.swift,HuffmanTree.swift}'
end
s.subspec 'LZMA' do |sp|
@@ -65,4 +65,10 @@ Pod::Spec.new do |s|
sp.source_files = 'Sources/XZArchive.swift'
end
+ s.subspec 'ZIP' do |sp|
+ sp.dependency 'SWCompression/Common'
+ sp.dependency 'SWCompression/Deflate'
+ sp.source_files = 'Sources/ZipContainer.swift'
+ end
+
end
diff --git a/SWCompression.xcodeproj/project.pbxproj b/SWCompression.xcodeproj/project.pbxproj
index 3bda26b5..f7d96cd9 100644
--- a/SWCompression.xcodeproj/project.pbxproj
+++ b/SWCompression.xcodeproj/project.pbxproj
@@ -24,7 +24,6 @@
063DF11A1DE1F2E200F38082 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 063DF1061DE1F07800F38082 /* Extensions.swift */; };
063DF11C1DE1F2E200F38082 /* HuffmanTree.swift in Sources */ = {isa = PBXBuildFile; fileRef = 063DF1081DE1F07800F38082 /* HuffmanTree.swift */; };
063DF11D1DE1F2E200F38082 /* Protocols.swift in Sources */ = {isa = PBXBuildFile; fileRef = 063DF1091DE1F07800F38082 /* Protocols.swift */; };
- 064FF4581E2B7F0E0062054B /* Zip64Test.zip in Resources */ = {isa = PBXBuildFile; fileRef = 064FF4571E2B7F0E0062054B /* Zip64Test.zip */; };
065569681DC65C2A00A47E66 /* GzipArchive.swift in Sources */ = {isa = PBXBuildFile; fileRef = 063364E21DC52979007E313F /* GzipArchive.swift */; };
065569691DC65C2A00A47E66 /* ZlibArchive.swift in Sources */ = {isa = PBXBuildFile; fileRef = 064492581DC606D400F10981 /* ZlibArchive.swift */; };
0655696A1DC65C2A00A47E66 /* Deflate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 061FCE251DBCC4BE0052F7BE /* Deflate.swift */; };
@@ -38,7 +37,6 @@
067518371E2A86F700D16354 /* ZipContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 067518351E2A86F700D16354 /* ZipContainer.swift */; };
067518381E2A86F700D16354 /* ZipContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 067518351E2A86F700D16354 /* ZipContainer.swift */; };
067518391E2A86F700D16354 /* ZipContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 067518351E2A86F700D16354 /* ZipContainer.swift */; };
- 0675183B1E2A881F00D16354 /* SWCompressionSourceCode.zip in Resources */ = {isa = PBXBuildFile; fileRef = 0675183A1E2A881F00D16354 /* SWCompressionSourceCode.zip */; };
0675183D1E2A883600D16354 /* ZipTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0675183C1E2A883600D16354 /* ZipTests.swift */; };
0680E1B11DDA2D7C005C05EB /* ZlibTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0680E1B01DDA2D7C005C05EB /* ZlibTests.swift */; };
0680E1B31DDA3D0A005C05EB /* GzipTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0680E1B21DDA3D0A005C05EB /* GzipTests.swift */; };
@@ -87,6 +85,9 @@
06BB8F311E0C2C720079FB9E /* LZMA2.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06BB8F2F1E0C2C720079FB9E /* LZMA2.swift */; };
06BB8F321E0C2C720079FB9E /* LZMA2.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06BB8F2F1E0C2C720079FB9E /* LZMA2.swift */; };
06BB8F331E0C2C720079FB9E /* LZMA2.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06BB8F2F1E0C2C720079FB9E /* LZMA2.swift */; };
+ 06BD0D231E3D0C630054AA5C /* SWCompressionSourceCode.zip in Resources */ = {isa = PBXBuildFile; fileRef = 06BD0D201E3D0C630054AA5C /* SWCompressionSourceCode.zip */; };
+ 06BD0D241E3D0C630054AA5C /* TestDataDescriptor.zip in Resources */ = {isa = PBXBuildFile; fileRef = 06BD0D211E3D0C630054AA5C /* TestDataDescriptor.zip */; };
+ 06BD0D251E3D0C630054AA5C /* TestZip64.zip in Resources */ = {isa = PBXBuildFile; fileRef = 06BD0D221E3D0C630054AA5C /* TestZip64.zip */; };
06BE1AD21DB410F100EE0F59 /* SWCompression.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 06BE1AC81DB410F100EE0F59 /* SWCompression.framework */; };
06CC18601DE35269003532F5 /* test1.answer in Resources */ = {isa = PBXBuildFile; fileRef = 06CC183F1DE35269003532F5 /* test1.answer */; };
06CC18611DE35269003532F5 /* test2.answer in Resources */ = {isa = PBXBuildFile; fileRef = 06CC18401DE35269003532F5 /* test2.answer */; };
@@ -159,12 +160,10 @@
063DF1081DE1F07800F38082 /* HuffmanTree.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = HuffmanTree.swift; path = Sources/HuffmanTree.swift; sourceTree = SOURCE_ROOT; };
063DF1091DE1F07800F38082 /* Protocols.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Protocols.swift; path = Sources/Protocols.swift; sourceTree = SOURCE_ROOT; };
064492581DC606D400F10981 /* ZlibArchive.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ZlibArchive.swift; sourceTree = ""; };
- 064FF4571E2B7F0E0062054B /* Zip64Test.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = Zip64Test.zip; sourceTree = ""; };
0655693F1DC659FF00A47E66 /* SWCompression.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SWCompression.framework; sourceTree = BUILT_PRODUCTS_DIR; };
0655694C1DC65A8000A47E66 /* SWCompression.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SWCompression.framework; sourceTree = BUILT_PRODUCTS_DIR; };
065569591DC65A9400A47E66 /* SWCompression.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SWCompression.framework; sourceTree = BUILT_PRODUCTS_DIR; };
067518351E2A86F700D16354 /* ZipContainer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ZipContainer.swift; sourceTree = ""; };
- 0675183A1E2A881F00D16354 /* SWCompressionSourceCode.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = SWCompressionSourceCode.zip; sourceTree = ""; };
0675183C1E2A883600D16354 /* ZipTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ZipTests.swift; sourceTree = ""; };
0680E1B01DDA2D7C005C05EB /* ZlibTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ZlibTests.swift; sourceTree = ""; };
0680E1B21DDA3D0A005C05EB /* GzipTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GzipTests.swift; sourceTree = ""; };
@@ -189,6 +188,9 @@
06B374C81E0EECCC00064853 /* random_file.gz */ = {isa = PBXFileReference; lastKnownFileType = archive.gzip; path = random_file.gz; sourceTree = ""; };
06B374CA1E0EECD500064853 /* random_file.zlib */ = {isa = PBXFileReference; lastKnownFileType = file; path = random_file.zlib; sourceTree = ""; };
06BB8F2F1E0C2C720079FB9E /* LZMA2.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LZMA2.swift; sourceTree = ""; };
+ 06BD0D201E3D0C630054AA5C /* SWCompressionSourceCode.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = SWCompressionSourceCode.zip; sourceTree = ""; };
+ 06BD0D211E3D0C630054AA5C /* TestDataDescriptor.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = TestDataDescriptor.zip; sourceTree = ""; };
+ 06BD0D221E3D0C630054AA5C /* TestZip64.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = TestZip64.zip; sourceTree = ""; };
06BE1AC81DB410F100EE0F59 /* SWCompression.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SWCompression.framework; sourceTree = BUILT_PRODUCTS_DIR; };
06BE1AD11DB410F100EE0F59 /* SWCompressionTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SWCompressionTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
06BE1AD81DB410F100EE0F59 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
@@ -307,7 +309,6 @@
06E234811E06A6C200F18798 /* CheckSums.swift */,
063DF1051DE1F07800F38082 /* DataWithPointer.swift */,
063DF1061DE1F07800F38082 /* Extensions.swift */,
- 063DF1081DE1F07800F38082 /* HuffmanTree.swift */,
063DF1091DE1F07800F38082 /* Protocols.swift */,
);
path = Common;
@@ -325,6 +326,16 @@
path = Service;
sourceTree = "";
};
+ 06BD0D1F1E3D0C630054AA5C /* ZIP */ = {
+ isa = PBXGroup;
+ children = (
+ 06BD0D201E3D0C630054AA5C /* SWCompressionSourceCode.zip */,
+ 06BD0D211E3D0C630054AA5C /* TestDataDescriptor.zip */,
+ 06BD0D221E3D0C630054AA5C /* TestZip64.zip */,
+ );
+ path = ZIP;
+ sourceTree = "";
+ };
06BE1ABE1DB410F100EE0F59 = {
isa = PBXGroup;
children = (
@@ -351,6 +362,7 @@
children = (
06A3931F1DE06FFE00182E12 /* Common */,
069D0FFE1E0D6CF200D8AA87 /* LZMA */,
+ 063DF1081DE1F07800F38082 /* HuffmanTree.swift */,
06E2346B1E068E9600F18798 /* XZArchive.swift */,
063364E21DC52979007E313F /* GzipArchive.swift */,
064492581DC606D400F10981 /* ZlibArchive.swift */,
@@ -388,10 +400,9 @@
06CC184E1DE35269003532F5 /* Deflate */,
06CC18561DE35269003532F5 /* GZip */,
069AC2161E02DE490041AC13 /* LZMA */,
+ 06BD0D1F1E3D0C630054AA5C /* ZIP */,
06CC185F1DE35269003532F5 /* test.zlib */,
06B374CA1E0EECD500064853 /* random_file.zlib */,
- 0675183A1E2A881F00D16354 /* SWCompressionSourceCode.zip */,
- 064FF4571E2B7F0E0062054B /* Zip64Test.zip */,
);
path = "Test Files";
sourceTree = "";
@@ -689,6 +700,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
+ 06BD0D241E3D0C630054AA5C /* TestDataDescriptor.zip in Resources */,
06CC18711DE35269003532F5 /* test4.deflate in Resources */,
06E234781E069A7F00F18798 /* test1.xz in Resources */,
06CC18621DE35269003532F5 /* test3.answer in Resources */,
@@ -698,17 +710,17 @@
06E2347A1E069A7F00F18798 /* test3.xz in Resources */,
06B374C91E0EECCC00064853 /* random_file.gz in Resources */,
06991C701E05A9F70030FF07 /* test9.lzma in Resources */,
- 064FF4581E2B7F0E0062054B /* Zip64Test.zip in Resources */,
06CC18781DE35269003532F5 /* test4.gz in Resources */,
06CC187B1DE35269003532F5 /* test7.gz in Resources */,
06CC18611DE35269003532F5 /* test2.answer in Resources */,
+ 06BD0D251E3D0C630054AA5C /* TestZip64.zip in Resources */,
06CC18701DE35269003532F5 /* test3.deflate in Resources */,
06CC186F1DE35269003532F5 /* test2.deflate in Resources */,
06E2347B1E069A7F00F18798 /* test4.xz in Resources */,
06CC186C1DE35269003532F5 /* test6.bz2 in Resources */,
06CC186B1DE35269003532F5 /* test5.bz2 in Resources */,
06CC18651DE35269003532F5 /* test6.answer in Resources */,
- 0675183B1E2A881F00D16354 /* SWCompressionSourceCode.zip in Resources */,
+ 06BD0D231E3D0C630054AA5C /* SWCompressionSourceCode.zip in Resources */,
06CC18631DE35269003532F5 /* test4.answer in Resources */,
06B374CB1E0EECD500064853 /* random_file.zlib in Resources */,
06FCA0581E033DDA00B6932F /* test8.answer in Resources */,
diff --git a/Sources/BZip2.swift b/Sources/BZip2.swift
index 2cc1010f..88520cd4 100644
--- a/Sources/BZip2.swift
+++ b/Sources/BZip2.swift
@@ -43,7 +43,7 @@ public enum BZip2Error: Error {
case SymbolNotFound
}
-/// Provides function to decompress data, which were compressed using BZip2
+/// Provides function to decompress data, which were compressed using BZip2.
public final class BZip2: DecompressionAlgorithm {
/**
diff --git a/Sources/Deflate.swift b/Sources/Deflate.swift
index d8f5444c..c7212a21 100644
--- a/Sources/Deflate.swift
+++ b/Sources/Deflate.swift
@@ -28,7 +28,7 @@ public enum DeflateError: Error {
case SymbolNotFound
}
-/// Provides function to decompress data, which were compressed with DEFLATE
+/// Provides function to decompress data, which were compressed with DEFLATE.
public final class Deflate: DecompressionAlgorithm {
/**
diff --git a/Sources/GzipArchive.swift b/Sources/GzipArchive.swift
index d7716f99..797a3a4b 100644
--- a/Sources/GzipArchive.swift
+++ b/Sources/GzipArchive.swift
@@ -39,7 +39,7 @@ public enum GzipError: Error {
case WrongISize
}
-/// A strucutre which provides information about gzip archive.
+/// A structure which provides information about gzip archive.
public struct GzipHeader {
struct Flags {
@@ -176,7 +176,7 @@ public struct GzipHeader {
}
-/// A class with unarchive function for gzip archives.
+/// Provides unarchive function for GZip archives.
public final class GzipArchive: Archive {
/**
diff --git a/Sources/Service/Info-iOS.plist b/Sources/Service/Info-iOS.plist
index 0e27f5f6..f69838d4 100644
--- a/Sources/Service/Info-iOS.plist
+++ b/Sources/Service/Info-iOS.plist
@@ -15,7 +15,7 @@
CFBundlePackageType
FMWK
CFBundleShortVersionString
- 2.0.1
+ 2.1.0
CFBundleVersion
$(CURRENT_PROJECT_VERSION)
NSPrincipalClass
diff --git a/Sources/Service/Info-tvOS.plist b/Sources/Service/Info-tvOS.plist
index 0e27f5f6..f69838d4 100644
--- a/Sources/Service/Info-tvOS.plist
+++ b/Sources/Service/Info-tvOS.plist
@@ -15,7 +15,7 @@
CFBundlePackageType
FMWK
CFBundleShortVersionString
- 2.0.1
+ 2.1.0
CFBundleVersion
$(CURRENT_PROJECT_VERSION)
NSPrincipalClass
diff --git a/Sources/Service/Info-watchOS.plist b/Sources/Service/Info-watchOS.plist
index 0e27f5f6..f69838d4 100644
--- a/Sources/Service/Info-watchOS.plist
+++ b/Sources/Service/Info-watchOS.plist
@@ -15,7 +15,7 @@
CFBundlePackageType
FMWK
CFBundleShortVersionString
- 2.0.1
+ 2.1.0
CFBundleVersion
$(CURRENT_PROJECT_VERSION)
NSPrincipalClass
diff --git a/Sources/Service/Info.plist b/Sources/Service/Info.plist
index be5b94bb..64df5ef2 100644
--- a/Sources/Service/Info.plist
+++ b/Sources/Service/Info.plist
@@ -15,7 +15,7 @@
CFBundlePackageType
FMWK
CFBundleShortVersionString
- 2.0.1
+ 2.1.0
CFBundleVersion
$(CURRENT_PROJECT_VERSION)
NSHumanReadableCopyright
diff --git a/Sources/XZArchive.swift b/Sources/XZArchive.swift
index 63174bcb..b5b9570f 100644
--- a/Sources/XZArchive.swift
+++ b/Sources/XZArchive.swift
@@ -9,8 +9,8 @@
import Foundation
/**
- Error happened during unarchiving xz archive.
- It may indicate that either the data is damaged or it might not be xz archive at all.
+ Error happened during unarchiving XZ archive.
+ It may indicate that either the data is damaged or it might not be XZ archive at all.
- `WrongMagic`: 'magic' bytes in archive's header or footer weren't equal to predefined value.
- `WrongArchiveInfo`: incorrect value of one of archive's special field (in block, index, header or footer).
@@ -54,7 +54,7 @@ public enum XZError: Error {
case MultiByteIntegerError
}
-/// A class with unarchive function for xz archives.
+/// Provides unarchive function for XZ archives.
public final class XZArchive: Archive {
/**
diff --git a/Sources/ZipContainer.swift b/Sources/ZipContainer.swift
index 396cda3d..d1823292 100644
--- a/Sources/ZipContainer.swift
+++ b/Sources/ZipContainer.swift
@@ -8,25 +8,70 @@
import Foundation
+/**
+ Error happened during processing ZIP archive (container).
+ It may indicate that either the data is damaged or it might not be ZIP archive (container) at all.
+
+ - `NotFoundCentralDirectoryEnd`: end of Central Directoty record wasn't found.
+ - `WrongSignature`: unsupported signature of one of ZIP container's structures.
+ - `WrongSize`: incorrect compressed or uncompressed size of a ZIP container's entry's data.
+ - `WrongVersion`: unsupported number of version needed to extract ZIP container
+ (unsupported features are required to open this file).
+ - `MultiVolumesNotSupported`: unsupported feature: multi-volumed or spanned container.
+ - `EncryptionNotSupported`: unsupported feature: encryption.
+ - `PatchingNotSupported`: unsupported feature: patched data.
+ - `CompressionNotSupported`: unsupported feature: specified compression method.
+ - `WrongLocalHeader`: local header of an entry wasn't consistent with Central Directory record.
+ - `WrongCRC32`: computed checksum of entry's data wasn't the same as the one stored in container.
+ */
public enum ZipError: Error {
+ /// End of Central Directoty record was not found.
case NotFoundCentralDirectoryEnd
- case WrongCentralDirectoryDisk
- case WrongZip64LocatorSignature
- case WrongZip64EndCentralDirectorySignature
+ /// Wrong signature of one of ZIP container's structures.
+ case WrongSignature
+ /// Wrong either compressed or uncompressed size of a ZIP container's entry.
+ case WrongSize
+ /// Wrong number of version needed to extract ZIP container.
case WrongVersion
- case WrongCentralDirectoryHeaderSignature
+ /// Archive either spanned or consists of several volumes. This feature is not supported.
+ case MultiVolumesNotSupported
+ /// Entry or record is encrypted. This feature is not supported.
case EncryptionNotSupported
+ /// Entry contains patched data. This feature is not supported.
case PatchingNotSupported
+ /// Wrong compression method of an entry.
case CompressionNotSupported
- case WrongLocalHeaderSignature
+ /// Wrong local header of an entry.
case WrongLocalHeader
- case DataDescriptorNotSupported
+ /// Wrong computed CRC32 of an entry.
case WrongCRC32
}
+/// Provides function to open ZIP archives (containers).
public class ZipContainer {
- public static func open(containerData data: Data) throws -> [String : Data] {
+ /**
+ Processes ZIP archive (container) and returns an array of tuples `(String, Data)`.
+ First member of a tuple is entry's name, second member is entry's data.
+
+ - Important: The order of entries is defined by ZIP archive and, particularly, creator of given ZIP container.
+ It is likely that directories will be encountered earlier than files stored in those directories,
+ but one SHOULD NOT assume that this is the case.
+
+ - Note: Currently, there is no universal (platform and file system independent) method to determine if entry is a directory.
+ One can check this by looking at the size of entry's data (it should be 0 for directory) AND
+ the last character of entry's name (it should be '/'). If all of these is true then entry is likely to be a directory.
+
+ - Note: Only ZIP containers complying to ISO/IEC 21320-1 standard are supported.
+
+ - Parameter containerData: Data of ZIP container.
+
+ - Throws: `ZipError` or `DeflateError` depending on the type of inconsistency in data.
+ It may indicate that either the container is damaged or it might not be ZIP container or compressed with Deflate at all.
+
+ - Returns: Array of pairs (tuples) where first member is `entryName` and second member is `entryData`.
+ */
+ public static func open(containerData data: Data) throws -> [(entryName: String, entryData: Data)] {
/// Object with input data which supports convenient work with bit shifts.
var pointerData = DataWithPointer(data: data, bitOrder: .reversed)
@@ -54,7 +99,7 @@ public class ZipContainer {
zip64RecordExists = true
}
guard currentDiskNumber == cdDiskNumber
- else { throw ZipError.WrongCentralDirectoryDisk }
+ else { throw ZipError.MultiVolumesNotSupported }
/// Number of CD entries on the current disk.
var cdEntriesCurrentDisk = pointerData.uint64FromAlignedBytes(count: 2)
@@ -64,7 +109,7 @@ public class ZipContainer {
zip64RecordExists = true
}
guard cdEntries == cdEntriesCurrentDisk
- else { throw ZipError.WrongCentralDirectoryDisk } // TODO: Probably it should be another error.
+ else { throw ZipError.MultiVolumesNotSupported }
/// Size of Central Directory.
var cdSize = pointerData.uint64FromAlignedBytes(count: 4)
@@ -88,41 +133,43 @@ public class ZipContainer {
// Check signature.
guard pointerData.uint64FromAlignedBytes(count: 4) == 0x07064b50
- else { throw ZipError.WrongZip64LocatorSignature }
+ else { throw ZipError.WrongSignature }
let zip64CDStartDisk = pointerData.uint64FromAlignedBytes(count: 4)
guard currentDiskNumber == zip64CDStartDisk
- else { throw ZipError.WrongCentralDirectoryDisk } // TODO: Probably it should be another error.
+ else { throw ZipError.MultiVolumesNotSupported }
let zip64CDEndOffset = pointerData.uint64FromAlignedBytes(count: 8)
let totalDisks = pointerData.uint64FromAlignedBytes(count: 1)
guard totalDisks == 1
- else { throw ZipError.WrongCentralDirectoryDisk } // TODO: Probably it should be another error.
+ else { throw ZipError.MultiVolumesNotSupported }
// Now we need to move to Zip64 End of CD.
pointerData.index = Int(UInt(truncatingBitPattern: zip64CDEndOffset))
// Check signature.
guard pointerData.uint64FromAlignedBytes(count: 4) == 0x06064b50
- else { throw ZipError.WrongZip64EndCentralDirectorySignature }
+ else { throw ZipError.WrongSignature }
- let zip64EndCDSize = pointerData.uint64FromAlignedBytes(count: 8)
+ // Following 8 bytes are size of end of zip64 CD, but we don't need it.
+ _ = pointerData.uint64FromAlignedBytes(count: 8)
- let versionMadeBy = pointerData.uint64FromAlignedBytes(count: 2)
+ // Next two bytes are version of compressor, but we don't need it.
+ _ = pointerData.uint64FromAlignedBytes(count: 2)
let versionNeeded = pointerData.uint64FromAlignedBytes(count: 2)
- guard versionNeeded <= 45 // TODO: This value should probably be adjusted according to really supported features.
+ guard versionNeeded <= 45
else { throw ZipError.WrongVersion }
// Update values read from basic End of CD to the one from Zip64 End of CD.
currentDiskNumber = pointerData.uint64FromAlignedBytes(count: 4)
cdDiskNumber = pointerData.uint64FromAlignedBytes(count: 4)
guard currentDiskNumber == cdDiskNumber
- else { throw ZipError.WrongCentralDirectoryDisk }
+ else { throw ZipError.MultiVolumesNotSupported }
cdEntriesCurrentDisk = pointerData.uint64FromAlignedBytes(count: 8)
cdEntries = pointerData.uint64FromAlignedBytes(count: 8)
guard cdEntries == cdEntriesCurrentDisk
- else { throw ZipError.WrongCentralDirectoryDisk } // TODO: Probably it should be another error.
+ else { throw ZipError.MultiVolumesNotSupported }
cdSize = pointerData.uint64FromAlignedBytes(count: 8)
cdOffset = pointerData.uint64FromAlignedBytes(count: 8)
@@ -136,19 +183,19 @@ public class ZipContainer {
// OK, now we are ready to read Central Directory itself.
pointerData.index = Int(UInt(truncatingBitPattern: cdOffset))
-
- var result: [String : Data] = [:]
+
+ var result: [(entryName: String, entryData: Data)] = []
for _ in 0..
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -87,6 +90,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -168,7 +174,7 @@
@@ -190,7 +196,7 @@
-
A class with unarchive function for gzip archives.
+
Provides unarchive function for GZip archives.
See more
@@ -203,7 +209,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Provides function to open ZIP archives (containers).
+
+
See more
+
+
+
Declaration
+
+
Swift
+
public class ZipContainer
+
+
+
+
@@ -238,7 +279,7 @@
@@ -260,7 +301,7 @@
-
A class with unarchive function for Zlib archives.
+
Provides unarchive function for Zlib archives.
See more
@@ -273,7 +314,7 @@
@@ -295,7 +336,7 @@
-
Provides function to decompress data, which were compressed with DEFLATE
+
Provides function to decompress data, which were compressed with DEFLATE.
See more
@@ -308,7 +349,7 @@
@@ -330,7 +371,7 @@
-
Provides function to decompress data, which were compressed using BZip2
+
Provides function to decompress data, which were compressed using BZip2.
See more
@@ -343,7 +384,7 @@
@@ -365,7 +406,7 @@
-
A class with unarchive function for xz archives.
+
Provides unarchive function for XZ archives.
See more
@@ -378,7 +419,7 @@
diff --git a/docs/Classes/BZip2.html b/docs/Classes/BZip2.html
index 36f87696..a99476d9 100644
--- a/docs/Classes/BZip2.html
+++ b/docs/Classes/BZip2.html
@@ -62,6 +62,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -88,6 +91,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -140,7 +146,7 @@
- Provides function to decompress data, which were compressed using BZip2
+ Provides function to decompress data, which were compressed using BZip2.
@@ -220,7 +226,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
diff --git a/docs/Classes/Deflate.html b/docs/Classes/Deflate.html
index b34f4303..6c863702 100644
--- a/docs/Classes/Deflate.html
+++ b/docs/Classes/Deflate.html
@@ -62,6 +62,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -88,6 +91,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -140,7 +146,7 @@
- Provides function to decompress data, which were compressed with DEFLATE
+ Provides function to decompress data, which were compressed with DEFLATE.
@@ -220,7 +226,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
diff --git a/docs/Classes/GzipArchive.html b/docs/Classes/GzipArchive.html
index a29755f5..d962fa55 100644
--- a/docs/Classes/GzipArchive.html
+++ b/docs/Classes/GzipArchive.html
@@ -62,6 +62,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -88,6 +91,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -140,7 +146,7 @@
- A class with unarchive function for gzip archives.
+ Provides unarchive function for GZip archives.
@@ -228,7 +234,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
diff --git a/docs/Classes/LZMA.html b/docs/Classes/LZMA.html
index 3ce2b815..7623d503 100644
--- a/docs/Classes/LZMA.html
+++ b/docs/Classes/LZMA.html
@@ -62,6 +62,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -88,6 +91,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -220,7 +226,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
diff --git a/docs/Classes/LZMA2.html b/docs/Classes/LZMA2.html
index 3586a546..602fd158 100644
--- a/docs/Classes/LZMA2.html
+++ b/docs/Classes/LZMA2.html
@@ -62,6 +62,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -88,6 +91,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -220,7 +226,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
diff --git a/docs/Classes/XZArchive.html b/docs/Classes/XZArchive.html
index 9898381e..a682cb4d 100644
--- a/docs/Classes/XZArchive.html
+++ b/docs/Classes/XZArchive.html
@@ -62,6 +62,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -88,6 +91,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -140,7 +146,7 @@
- A class with unarchive function for xz archives.
+ Provides unarchive function for XZ archives.
@@ -224,7 +230,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
diff --git a/docs/Classes/ZipContainer.html b/docs/Classes/ZipContainer.html
new file mode 100644
index 00000000..1f2b185b
--- /dev/null
+++ b/docs/Classes/ZipContainer.html
@@ -0,0 +1,268 @@
+
+
+
+ ZipContainer Class Reference
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ SWCompression Reference
+
+ ZipContainer Class Reference
+
+
+
+
+
+
+
+
+
+
+
ZipContainer
+
+
+
public class ZipContainer
+
+
+
+
Provides function to open ZIP archives (containers).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Processes ZIP archive (container) and returns an array of tuples (String, Data).
+First member of a tuple is entry’s name, second member is entry’s data.
+
+
+
Important
+
The order of entries is defined by ZIP archive and, particularly, creator of given ZIP container.
+It is likely that directories will be encountered earlier than files stored in those directories,
+but one SHOULD NOT assume that this is the case.
+
+
+
+
+
Note
+
Currently, there is no universal (platform and file system independent) method to determine if entry is a directory.
+One can check this by looking at the size of entry’s data (it should be 0 for directory) AND
+the last character of entry’s name (it should be ‘/’). If all of these is true then entry is likely to be a directory.
+
+
+
+
+
Note
+
Only ZIP containers complying to ISO/IEC 21320-1 standard are supported.
+
+
+
+
+
Parameter
+
Parameter containerData: Data of ZIP container.
+
+
+
+
+
Throws
+
ZipError or DeflateError depending on the type of inconsistency in data.
+It may indicate that either the container is damaged or it might not be ZIP container or compressed with Deflate at all.
+
+
+
+
+
Returns
+
Array of pairs (tuples) where first member is entryName and second member is entryData.
+
+
+
+
+
+
Declaration
+
+
Swift
+
public static func open ( containerData data : Data ) throws -> [( entryName : String , entryData : Data )]
+
+
+
+
+
Parameters
+
+
+
+
+
+ containerData
+
+
+
+
+
Data of ZIP container.
+
+
+
+
+
+
+
+
+
Return Value
+
Array of pairs (tuples) where first member is entryName and second member is entryData.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/Classes/ZlibArchive.html b/docs/Classes/ZlibArchive.html
index f5ebf934..025dd6f4 100644
--- a/docs/Classes/ZlibArchive.html
+++ b/docs/Classes/ZlibArchive.html
@@ -62,6 +62,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -88,6 +91,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -140,7 +146,7 @@
- A class with unarchive function for Zlib archives.
+ Provides unarchive function for Zlib archives.
@@ -228,7 +234,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
diff --git a/docs/Enums.html b/docs/Enums.html
index e1202ce9..fe9c3bca 100644
--- a/docs/Enums.html
+++ b/docs/Enums.html
@@ -61,6 +61,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -87,6 +90,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -177,7 +183,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
@@ -224,7 +230,57 @@ Associated value contains already decompressed data.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Error happened during processing ZIP archive (container).
+It may indicate that either the data is damaged or it might not be ZIP archive (container) at all.
+
+
+NotFoundCentralDirectoryEnd: end of Central Directoty record wasn’t found.
+WrongSignature: unsupported signature of one of ZIP container’s structures.
+WrongSize: incorrect compressed or uncompressed size of a ZIP container’s entry’s data.
+WrongVersion: unsupported number of version needed to extract ZIP container
+(unsupported features are required to open this file).
+MultiVolumesNotSupported: unsupported feature: multi-volumed or spanned container.
+EncryptionNotSupported: unsupported feature: encryption.
+PatchingNotSupported: unsupported feature: patched data.
+CompressionNotSupported: unsupported feature: specified compression method.
+WrongLocalHeader: local header of an entry wasn’t consistent with Central Directory record.
+WrongCRC32: computed checksum of entry’s data wasn’t the same as the one stored in container.
+
+
+
See more
+
+
+
Declaration
+
+
Swift
+
public enum ZipError : Error
+
+
+
+
@@ -273,7 +329,7 @@ than the repeat length.
@@ -318,7 +374,7 @@ Associated value contains already decompressed data.
@@ -361,7 +417,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
@@ -409,7 +465,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
@@ -431,8 +487,8 @@ It may indicate that either the data is damaged or it might not be compressed wi
-
Error happened during unarchiving xz archive.
-It may indicate that either the data is damaged or it might not be xz archive at all.
+
Error happened during unarchiving XZ archive.
+It may indicate that either the data is damaged or it might not be XZ archive at all.
WrongMagic: ‘magic’ bytes in archive’s header or footer weren’t equal to predefined value.
@@ -460,7 +516,7 @@ Associated value contains already decompressed data.
diff --git a/docs/Enums/BZip2Error.html b/docs/Enums/BZip2Error.html
index 92157720..a88f9c63 100644
--- a/docs/Enums/BZip2Error.html
+++ b/docs/Enums/BZip2Error.html
@@ -62,6 +62,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -88,6 +91,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -187,7 +193,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
@@ -221,7 +227,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
@@ -255,7 +261,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
@@ -289,7 +295,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
@@ -323,7 +329,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
@@ -357,7 +363,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
@@ -391,7 +397,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
@@ -425,7 +431,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
@@ -459,7 +465,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
diff --git a/docs/Enums/DeflateError.html b/docs/Enums/DeflateError.html
index 774a63ad..ea0483a8 100644
--- a/docs/Enums/DeflateError.html
+++ b/docs/Enums/DeflateError.html
@@ -62,6 +62,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -88,6 +91,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -182,7 +188,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
@@ -216,7 +222,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
@@ -250,7 +256,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
@@ -284,7 +290,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
diff --git a/docs/Enums/GzipError.html b/docs/Enums/GzipError.html
index 06eeb79a..4fe4bfda 100644
--- a/docs/Enums/GzipError.html
+++ b/docs/Enums/GzipError.html
@@ -62,6 +62,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -88,6 +91,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -186,7 +192,7 @@ Associated value contains already decompressed data.
@@ -220,7 +226,7 @@ Associated value contains already decompressed data.
@@ -254,7 +260,7 @@ Associated value contains already decompressed data.
@@ -288,7 +294,7 @@ Associated value contains already decompressed data.
@@ -323,7 +329,7 @@ Associated value contains already decompressed data.
@@ -357,7 +363,7 @@ Associated value contains already decompressed data.
diff --git a/docs/Enums/LZMA2Error.html b/docs/Enums/LZMA2Error.html
index 1d0ded17..bd30c240 100644
--- a/docs/Enums/LZMA2Error.html
+++ b/docs/Enums/LZMA2Error.html
@@ -62,6 +62,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -88,6 +91,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -183,7 +189,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
@@ -217,7 +223,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
@@ -251,7 +257,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
@@ -285,7 +291,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
@@ -320,7 +326,7 @@ amount of compressed data read was different from the one stored in LZMA2 packet
diff --git a/docs/Enums/LZMAError.html b/docs/Enums/LZMAError.html
index aed102bd..44158bbf 100644
--- a/docs/Enums/LZMAError.html
+++ b/docs/Enums/LZMAError.html
@@ -62,6 +62,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -88,6 +91,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -188,7 +194,7 @@ than the repeat length.
@@ -222,7 +228,7 @@ than the repeat length.
@@ -256,7 +262,7 @@ than the repeat length.
@@ -290,7 +296,7 @@ than the repeat length.
@@ -324,7 +330,7 @@ than the repeat length.
@@ -358,7 +364,7 @@ than the repeat length.
@@ -392,7 +398,7 @@ than the repeat length.
diff --git a/docs/Enums/XZError.html b/docs/Enums/XZError.html
index 21dfa7bd..864608ca 100644
--- a/docs/Enums/XZError.html
+++ b/docs/Enums/XZError.html
@@ -62,6 +62,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -88,6 +91,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -140,8 +146,8 @@
- Error happened during unarchiving xz archive.
-It may indicate that either the data is damaged or it might not be xz archive at all.
+ Error happened during unarchiving XZ archive.
+It may indicate that either the data is damaged or it might not be XZ archive at all.
WrongMagic: ‘magic’ bytes in archive’s header or footer weren’t equal to predefined value.
@@ -190,7 +196,7 @@ Associated value contains already decompressed data.
@@ -224,7 +230,7 @@ Associated value contains already decompressed data.
@@ -258,7 +264,7 @@ Associated value contains already decompressed data.
@@ -292,7 +298,7 @@ Associated value contains already decompressed data.
@@ -326,7 +332,7 @@ Associated value contains already decompressed data.
@@ -360,7 +366,7 @@ Associated value contains already decompressed data.
@@ -395,7 +401,7 @@ amount of compressed data read was different from the one stored in block header
@@ -430,7 +436,7 @@ Associated value contains already decompressed data.
@@ -464,7 +470,7 @@ Associated value contains already decompressed data.
@@ -498,7 +504,7 @@ Associated value contains already decompressed data.
diff --git a/docs/Enums/ZipError.html b/docs/Enums/ZipError.html
new file mode 100644
index 00000000..7bb1976a
--- /dev/null
+++ b/docs/Enums/ZipError.html
@@ -0,0 +1,522 @@
+
+
+
+ ZipError Enum Reference
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ SWCompression Reference
+
+ ZipError Enum Reference
+
+
+
+
+
+
+
+
+
+
+
ZipError
+
+
+
public enum ZipError : Error
+
+
+
+
Error happened during processing ZIP archive (container).
+It may indicate that either the data is damaged or it might not be ZIP archive (container) at all.
+
+
+NotFoundCentralDirectoryEnd: end of Central Directoty record wasn’t found.
+WrongSignature: unsupported signature of one of ZIP container’s structures.
+WrongSize: incorrect compressed or uncompressed size of a ZIP container’s entry’s data.
+WrongVersion: unsupported number of version needed to extract ZIP container
+(unsupported features are required to open this file).
+MultiVolumesNotSupported: unsupported feature: multi-volumed or spanned container.
+EncryptionNotSupported: unsupported feature: encryption.
+PatchingNotSupported: unsupported feature: patched data.
+CompressionNotSupported: unsupported feature: specified compression method.
+WrongLocalHeader: local header of an entry wasn’t consistent with Central Directory record.
+WrongCRC32: computed checksum of entry’s data wasn’t the same as the one stored in container.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
End of Central Directoty record was not found.
+
+
+
+
Declaration
+
+
Swift
+
case NotFoundCentralDirectoryEnd
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Wrong signature of one of ZIP container’s structures.
+
+
+
+
Declaration
+
+
Swift
+
case WrongSignature
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Wrong either compressed or uncompressed size of a ZIP container’s entry.
+
+
+
+
Declaration
+
+
Swift
+
case WrongSize
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Wrong number of version needed to extract ZIP container.
+
+
+
+
Declaration
+
+
Swift
+
case WrongVersion
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Archive either spanned or consists of several volumes. This feature is not supported.
+
+
+
+
Declaration
+
+
Swift
+
case MultiVolumesNotSupported
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Entry or record is encrypted. This feature is not supported.
+
+
+
+
Declaration
+
+
Swift
+
case EncryptionNotSupported
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Entry contains patched data. This feature is not supported.
+
+
+
+
Declaration
+
+
Swift
+
case PatchingNotSupported
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Wrong compression method of an entry.
+
+
+
+
Declaration
+
+
Swift
+
case CompressionNotSupported
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Wrong local header of an entry.
+
+
+
+
Declaration
+
+
Swift
+
case WrongLocalHeader
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Wrong computed CRC32 of an entry.
+
+
+
+
Declaration
+
+
Swift
+
case WrongCRC32
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/Enums/ZlibError.html b/docs/Enums/ZlibError.html
index de1e9a5d..707dd6c3 100644
--- a/docs/Enums/ZlibError.html
+++ b/docs/Enums/ZlibError.html
@@ -62,6 +62,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -88,6 +91,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -184,7 +190,7 @@ Associated value contains already decompressed data.
@@ -218,7 +224,7 @@ Associated value contains already decompressed data.
@@ -252,7 +258,7 @@ Associated value contains already decompressed data.
@@ -286,7 +292,7 @@ Associated value contains already decompressed data.
@@ -321,7 +327,7 @@ Associated value contains already decompressed data.
diff --git a/docs/Protocols.html b/docs/Protocols.html
index adef0264..c1fa9c82 100644
--- a/docs/Protocols.html
+++ b/docs/Protocols.html
@@ -61,6 +61,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -87,6 +90,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -168,7 +174,7 @@
@@ -199,7 +205,7 @@
diff --git a/docs/Protocols/Archive.html b/docs/Protocols/Archive.html
index b9176b3b..84a991bd 100644
--- a/docs/Protocols/Archive.html
+++ b/docs/Protocols/Archive.html
@@ -62,6 +62,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -88,6 +91,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -174,7 +180,7 @@
diff --git a/docs/Protocols/DecompressionAlgorithm.html b/docs/Protocols/DecompressionAlgorithm.html
index 5edf4320..d325c541 100644
--- a/docs/Protocols/DecompressionAlgorithm.html
+++ b/docs/Protocols/DecompressionAlgorithm.html
@@ -62,6 +62,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -88,6 +91,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -174,7 +180,7 @@
diff --git a/docs/Structs.html b/docs/Structs.html
index 8529635d..4af3de12 100644
--- a/docs/Structs.html
+++ b/docs/Structs.html
@@ -61,6 +61,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -87,6 +90,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -155,7 +161,7 @@
-
A strucutre which provides information about gzip archive.
+
A structure which provides information about gzip archive.
See more
@@ -168,7 +174,7 @@
@@ -190,7 +196,7 @@
-
A strucutre which provides information about zlib archive.
+
A structure which provides information about zlib archive.
See more
@@ -203,7 +209,7 @@
diff --git a/docs/Structs/GzipHeader.html b/docs/Structs/GzipHeader.html
index 6a8090da..b8746b3d 100644
--- a/docs/Structs/GzipHeader.html
+++ b/docs/Structs/GzipHeader.html
@@ -62,6 +62,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -88,6 +91,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -140,7 +146,7 @@
- A strucutre which provides information about gzip archive.
+ A structure which provides information about gzip archive.
@@ -175,7 +181,7 @@
@@ -206,7 +212,7 @@
@@ -236,7 +242,7 @@
@@ -266,7 +272,7 @@
@@ -296,7 +302,7 @@
@@ -326,7 +332,7 @@
@@ -356,7 +362,7 @@
@@ -421,7 +427,7 @@ it might not be compressed with gzip at all.
diff --git a/docs/Structs/GzipHeader/CompressionMethod.html b/docs/Structs/GzipHeader/CompressionMethod.html
index 8413dd76..203fa4c1 100644
--- a/docs/Structs/GzipHeader/CompressionMethod.html
+++ b/docs/Structs/GzipHeader/CompressionMethod.html
@@ -62,6 +62,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -88,6 +91,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -174,7 +180,7 @@
diff --git a/docs/Structs/GzipHeader/FileSystemType.html b/docs/Structs/GzipHeader/FileSystemType.html
index 73f0fd1a..59859573 100644
--- a/docs/Structs/GzipHeader/FileSystemType.html
+++ b/docs/Structs/GzipHeader/FileSystemType.html
@@ -62,6 +62,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -88,6 +91,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -174,7 +180,7 @@
@@ -208,7 +214,7 @@
@@ -242,7 +248,7 @@
@@ -276,7 +282,7 @@
@@ -310,7 +316,7 @@
diff --git a/docs/Structs/ZlibHeader.html b/docs/Structs/ZlibHeader.html
index 5f6bb135..ea7ac348 100644
--- a/docs/Structs/ZlibHeader.html
+++ b/docs/Structs/ZlibHeader.html
@@ -62,6 +62,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -88,6 +91,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -140,7 +146,7 @@
- A strucutre which provides information about zlib archive.
+ A structure which provides information about zlib archive.
@@ -175,7 +181,7 @@
@@ -206,7 +212,7 @@
@@ -236,7 +242,7 @@
@@ -266,7 +272,7 @@
@@ -296,7 +302,7 @@
@@ -361,7 +367,7 @@ it might not be compressed with zlib at all.
diff --git a/docs/Structs/ZlibHeader/CompressionLevel.html b/docs/Structs/ZlibHeader/CompressionLevel.html
index a6b0c64e..b0ed94fa 100644
--- a/docs/Structs/ZlibHeader/CompressionLevel.html
+++ b/docs/Structs/ZlibHeader/CompressionLevel.html
@@ -62,6 +62,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -88,6 +91,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -174,7 +180,7 @@
@@ -208,7 +214,7 @@
@@ -242,7 +248,7 @@
@@ -276,7 +282,7 @@
diff --git a/docs/Structs/ZlibHeader/CompressionMethod.html b/docs/Structs/ZlibHeader/CompressionMethod.html
index 192fabd2..21086040 100644
--- a/docs/Structs/ZlibHeader/CompressionMethod.html
+++ b/docs/Structs/ZlibHeader/CompressionMethod.html
@@ -62,6 +62,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -88,6 +91,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -174,7 +180,7 @@
diff --git a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Classes.html b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Classes.html
index 1f044acc..0bc99893 100644
--- a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Classes.html
+++ b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Classes.html
@@ -61,6 +61,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -87,6 +90,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -168,7 +174,7 @@
@@ -190,7 +196,7 @@
-
A class with unarchive function for gzip archives.
+
Provides unarchive function for GZip archives.
See more
@@ -203,7 +209,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Provides function to open ZIP archives (containers).
+
+
See more
+
+
+
Declaration
+
+
Swift
+
public class ZipContainer
+
+
+
+
@@ -238,7 +279,7 @@
@@ -260,7 +301,7 @@
-
A class with unarchive function for Zlib archives.
+
Provides unarchive function for Zlib archives.
See more
@@ -273,7 +314,7 @@
@@ -295,7 +336,7 @@
-
Provides function to decompress data, which were compressed with DEFLATE
+
Provides function to decompress data, which were compressed with DEFLATE.
See more
@@ -308,7 +349,7 @@
@@ -330,7 +371,7 @@
-
Provides function to decompress data, which were compressed using BZip2
+
Provides function to decompress data, which were compressed using BZip2.
See more
@@ -343,7 +384,7 @@
@@ -365,7 +406,7 @@
-
A class with unarchive function for xz archives.
+
Provides unarchive function for XZ archives.
See more
@@ -378,7 +419,7 @@
diff --git a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Classes/BZip2.html b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Classes/BZip2.html
index 36f87696..a99476d9 100644
--- a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Classes/BZip2.html
+++ b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Classes/BZip2.html
@@ -62,6 +62,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -88,6 +91,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -140,7 +146,7 @@
- Provides function to decompress data, which were compressed using BZip2
+ Provides function to decompress data, which were compressed using BZip2.
@@ -220,7 +226,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
diff --git a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Classes/Deflate.html b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Classes/Deflate.html
index b34f4303..6c863702 100644
--- a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Classes/Deflate.html
+++ b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Classes/Deflate.html
@@ -62,6 +62,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -88,6 +91,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -140,7 +146,7 @@
- Provides function to decompress data, which were compressed with DEFLATE
+ Provides function to decompress data, which were compressed with DEFLATE.
@@ -220,7 +226,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
diff --git a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Classes/GzipArchive.html b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Classes/GzipArchive.html
index a29755f5..d962fa55 100644
--- a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Classes/GzipArchive.html
+++ b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Classes/GzipArchive.html
@@ -62,6 +62,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -88,6 +91,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -140,7 +146,7 @@
- A class with unarchive function for gzip archives.
+ Provides unarchive function for GZip archives.
@@ -228,7 +234,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
diff --git a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Classes/LZMA.html b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Classes/LZMA.html
index 3ce2b815..7623d503 100644
--- a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Classes/LZMA.html
+++ b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Classes/LZMA.html
@@ -62,6 +62,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -88,6 +91,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -220,7 +226,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
diff --git a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Classes/LZMA2.html b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Classes/LZMA2.html
index 3586a546..602fd158 100644
--- a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Classes/LZMA2.html
+++ b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Classes/LZMA2.html
@@ -62,6 +62,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -88,6 +91,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -220,7 +226,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
diff --git a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Classes/XZArchive.html b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Classes/XZArchive.html
index 9898381e..a682cb4d 100644
--- a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Classes/XZArchive.html
+++ b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Classes/XZArchive.html
@@ -62,6 +62,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -88,6 +91,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -140,7 +146,7 @@
- A class with unarchive function for xz archives.
+ Provides unarchive function for XZ archives.
@@ -224,7 +230,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
diff --git a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Classes/ZipContainer.html b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Classes/ZipContainer.html
new file mode 100644
index 00000000..1f2b185b
--- /dev/null
+++ b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Classes/ZipContainer.html
@@ -0,0 +1,268 @@
+
+
+
+ ZipContainer Class Reference
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ SWCompression Reference
+
+ ZipContainer Class Reference
+
+
+
+
+
+
+
+
+
+
+
ZipContainer
+
+
+
public class ZipContainer
+
+
+
+
Provides function to open ZIP archives (containers).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Processes ZIP archive (container) and returns an array of tuples (String, Data).
+First member of a tuple is entry’s name, second member is entry’s data.
+
+
+
Important
+
The order of entries is defined by ZIP archive and, particularly, creator of given ZIP container.
+It is likely that directories will be encountered earlier than files stored in those directories,
+but one SHOULD NOT assume that this is the case.
+
+
+
+
+
Note
+
Currently, there is no universal (platform and file system independent) method to determine if entry is a directory.
+One can check this by looking at the size of entry’s data (it should be 0 for directory) AND
+the last character of entry’s name (it should be ‘/’). If all of these is true then entry is likely to be a directory.
+
+
+
+
+
Note
+
Only ZIP containers complying to ISO/IEC 21320-1 standard are supported.
+
+
+
+
+
Parameter
+
Parameter containerData: Data of ZIP container.
+
+
+
+
+
Throws
+
ZipError or DeflateError depending on the type of inconsistency in data.
+It may indicate that either the container is damaged or it might not be ZIP container or compressed with Deflate at all.
+
+
+
+
+
Returns
+
Array of pairs (tuples) where first member is entryName and second member is entryData.
+
+
+
+
+
+
Declaration
+
+
Swift
+
public static func open ( containerData data : Data ) throws -> [( entryName : String , entryData : Data )]
+
+
+
+
+
Parameters
+
+
+
+
+
+ containerData
+
+
+
+
+
Data of ZIP container.
+
+
+
+
+
+
+
+
+
Return Value
+
Array of pairs (tuples) where first member is entryName and second member is entryData.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Classes/ZlibArchive.html b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Classes/ZlibArchive.html
index f5ebf934..025dd6f4 100644
--- a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Classes/ZlibArchive.html
+++ b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Classes/ZlibArchive.html
@@ -62,6 +62,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -88,6 +91,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -140,7 +146,7 @@
- A class with unarchive function for Zlib archives.
+ Provides unarchive function for Zlib archives.
@@ -228,7 +234,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
diff --git a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Enums.html b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Enums.html
index e1202ce9..fe9c3bca 100644
--- a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Enums.html
+++ b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Enums.html
@@ -61,6 +61,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -87,6 +90,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -177,7 +183,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
@@ -224,7 +230,57 @@ Associated value contains already decompressed data.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Error happened during processing ZIP archive (container).
+It may indicate that either the data is damaged or it might not be ZIP archive (container) at all.
+
+
+NotFoundCentralDirectoryEnd: end of Central Directoty record wasn’t found.
+WrongSignature: unsupported signature of one of ZIP container’s structures.
+WrongSize: incorrect compressed or uncompressed size of a ZIP container’s entry’s data.
+WrongVersion: unsupported number of version needed to extract ZIP container
+(unsupported features are required to open this file).
+MultiVolumesNotSupported: unsupported feature: multi-volumed or spanned container.
+EncryptionNotSupported: unsupported feature: encryption.
+PatchingNotSupported: unsupported feature: patched data.
+CompressionNotSupported: unsupported feature: specified compression method.
+WrongLocalHeader: local header of an entry wasn’t consistent with Central Directory record.
+WrongCRC32: computed checksum of entry’s data wasn’t the same as the one stored in container.
+
+
+
See more
+
+
+
Declaration
+
+
Swift
+
public enum ZipError : Error
+
+
+
+
@@ -273,7 +329,7 @@ than the repeat length.
@@ -318,7 +374,7 @@ Associated value contains already decompressed data.
@@ -361,7 +417,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
@@ -409,7 +465,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
@@ -431,8 +487,8 @@ It may indicate that either the data is damaged or it might not be compressed wi
-
Error happened during unarchiving xz archive.
-It may indicate that either the data is damaged or it might not be xz archive at all.
+
Error happened during unarchiving XZ archive.
+It may indicate that either the data is damaged or it might not be XZ archive at all.
WrongMagic: ‘magic’ bytes in archive’s header or footer weren’t equal to predefined value.
@@ -460,7 +516,7 @@ Associated value contains already decompressed data.
diff --git a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Enums/BZip2Error.html b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Enums/BZip2Error.html
index 92157720..a88f9c63 100644
--- a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Enums/BZip2Error.html
+++ b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Enums/BZip2Error.html
@@ -62,6 +62,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -88,6 +91,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -187,7 +193,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
@@ -221,7 +227,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
@@ -255,7 +261,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
@@ -289,7 +295,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
@@ -323,7 +329,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
@@ -357,7 +363,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
@@ -391,7 +397,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
@@ -425,7 +431,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
@@ -459,7 +465,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
diff --git a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Enums/DeflateError.html b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Enums/DeflateError.html
index 774a63ad..ea0483a8 100644
--- a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Enums/DeflateError.html
+++ b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Enums/DeflateError.html
@@ -62,6 +62,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -88,6 +91,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -182,7 +188,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
@@ -216,7 +222,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
@@ -250,7 +256,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
@@ -284,7 +290,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
diff --git a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Enums/GzipError.html b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Enums/GzipError.html
index 06eeb79a..4fe4bfda 100644
--- a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Enums/GzipError.html
+++ b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Enums/GzipError.html
@@ -62,6 +62,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -88,6 +91,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -186,7 +192,7 @@ Associated value contains already decompressed data.
@@ -220,7 +226,7 @@ Associated value contains already decompressed data.
@@ -254,7 +260,7 @@ Associated value contains already decompressed data.
@@ -288,7 +294,7 @@ Associated value contains already decompressed data.
@@ -323,7 +329,7 @@ Associated value contains already decompressed data.
@@ -357,7 +363,7 @@ Associated value contains already decompressed data.
diff --git a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Enums/LZMA2Error.html b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Enums/LZMA2Error.html
index 1d0ded17..bd30c240 100644
--- a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Enums/LZMA2Error.html
+++ b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Enums/LZMA2Error.html
@@ -62,6 +62,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -88,6 +91,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -183,7 +189,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
@@ -217,7 +223,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
@@ -251,7 +257,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
@@ -285,7 +291,7 @@ It may indicate that either the data is damaged or it might not be compressed wi
@@ -320,7 +326,7 @@ amount of compressed data read was different from the one stored in LZMA2 packet
diff --git a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Enums/LZMAError.html b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Enums/LZMAError.html
index aed102bd..44158bbf 100644
--- a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Enums/LZMAError.html
+++ b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Enums/LZMAError.html
@@ -62,6 +62,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -88,6 +91,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -188,7 +194,7 @@ than the repeat length.
@@ -222,7 +228,7 @@ than the repeat length.
@@ -256,7 +262,7 @@ than the repeat length.
@@ -290,7 +296,7 @@ than the repeat length.
@@ -324,7 +330,7 @@ than the repeat length.
@@ -358,7 +364,7 @@ than the repeat length.
@@ -392,7 +398,7 @@ than the repeat length.
diff --git a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Enums/XZError.html b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Enums/XZError.html
index 21dfa7bd..864608ca 100644
--- a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Enums/XZError.html
+++ b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Enums/XZError.html
@@ -62,6 +62,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -88,6 +91,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -140,8 +146,8 @@
- Error happened during unarchiving xz archive.
-It may indicate that either the data is damaged or it might not be xz archive at all.
+ Error happened during unarchiving XZ archive.
+It may indicate that either the data is damaged or it might not be XZ archive at all.
WrongMagic: ‘magic’ bytes in archive’s header or footer weren’t equal to predefined value.
@@ -190,7 +196,7 @@ Associated value contains already decompressed data.
@@ -224,7 +230,7 @@ Associated value contains already decompressed data.
@@ -258,7 +264,7 @@ Associated value contains already decompressed data.
@@ -292,7 +298,7 @@ Associated value contains already decompressed data.
@@ -326,7 +332,7 @@ Associated value contains already decompressed data.
@@ -360,7 +366,7 @@ Associated value contains already decompressed data.
@@ -395,7 +401,7 @@ amount of compressed data read was different from the one stored in block header
@@ -430,7 +436,7 @@ Associated value contains already decompressed data.
@@ -464,7 +470,7 @@ Associated value contains already decompressed data.
@@ -498,7 +504,7 @@ Associated value contains already decompressed data.
diff --git a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Enums/ZipError.html b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Enums/ZipError.html
new file mode 100644
index 00000000..7bb1976a
--- /dev/null
+++ b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Enums/ZipError.html
@@ -0,0 +1,522 @@
+
+
+
+ ZipError Enum Reference
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ SWCompression Reference
+
+ ZipError Enum Reference
+
+
+
+
+
+
+
+
+
+
+
ZipError
+
+
+
public enum ZipError : Error
+
+
+
+
Error happened during processing ZIP archive (container).
+It may indicate that either the data is damaged or it might not be ZIP archive (container) at all.
+
+
+NotFoundCentralDirectoryEnd: end of Central Directoty record wasn’t found.
+WrongSignature: unsupported signature of one of ZIP container’s structures.
+WrongSize: incorrect compressed or uncompressed size of a ZIP container’s entry’s data.
+WrongVersion: unsupported number of version needed to extract ZIP container
+(unsupported features are required to open this file).
+MultiVolumesNotSupported: unsupported feature: multi-volumed or spanned container.
+EncryptionNotSupported: unsupported feature: encryption.
+PatchingNotSupported: unsupported feature: patched data.
+CompressionNotSupported: unsupported feature: specified compression method.
+WrongLocalHeader: local header of an entry wasn’t consistent with Central Directory record.
+WrongCRC32: computed checksum of entry’s data wasn’t the same as the one stored in container.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
End of Central Directoty record was not found.
+
+
+
+
Declaration
+
+
Swift
+
case NotFoundCentralDirectoryEnd
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Wrong signature of one of ZIP container’s structures.
+
+
+
+
Declaration
+
+
Swift
+
case WrongSignature
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Wrong either compressed or uncompressed size of a ZIP container’s entry.
+
+
+
+
Declaration
+
+
Swift
+
case WrongSize
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Wrong number of version needed to extract ZIP container.
+
+
+
+
Declaration
+
+
Swift
+
case WrongVersion
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Archive either spanned or consists of several volumes. This feature is not supported.
+
+
+
+
Declaration
+
+
Swift
+
case MultiVolumesNotSupported
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Entry or record is encrypted. This feature is not supported.
+
+
+
+
Declaration
+
+
Swift
+
case EncryptionNotSupported
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Entry contains patched data. This feature is not supported.
+
+
+
+
Declaration
+
+
Swift
+
case PatchingNotSupported
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Wrong compression method of an entry.
+
+
+
+
Declaration
+
+
Swift
+
case CompressionNotSupported
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Wrong local header of an entry.
+
+
+
+
Declaration
+
+
Swift
+
case WrongLocalHeader
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Wrong computed CRC32 of an entry.
+
+
+
+
Declaration
+
+
Swift
+
case WrongCRC32
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Enums/ZlibError.html b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Enums/ZlibError.html
index de1e9a5d..707dd6c3 100644
--- a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Enums/ZlibError.html
+++ b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Enums/ZlibError.html
@@ -62,6 +62,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -88,6 +91,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -184,7 +190,7 @@ Associated value contains already decompressed data.
@@ -218,7 +224,7 @@ Associated value contains already decompressed data.
@@ -252,7 +258,7 @@ Associated value contains already decompressed data.
@@ -286,7 +292,7 @@ Associated value contains already decompressed data.
@@ -321,7 +327,7 @@ Associated value contains already decompressed data.
diff --git a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Protocols.html b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Protocols.html
index adef0264..c1fa9c82 100644
--- a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Protocols.html
+++ b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Protocols.html
@@ -61,6 +61,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -87,6 +90,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -168,7 +174,7 @@
@@ -199,7 +205,7 @@
diff --git a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Protocols/Archive.html b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Protocols/Archive.html
index b9176b3b..84a991bd 100644
--- a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Protocols/Archive.html
+++ b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Protocols/Archive.html
@@ -62,6 +62,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -88,6 +91,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -174,7 +180,7 @@
diff --git a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Protocols/DecompressionAlgorithm.html b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Protocols/DecompressionAlgorithm.html
index 5edf4320..d325c541 100644
--- a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Protocols/DecompressionAlgorithm.html
+++ b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Protocols/DecompressionAlgorithm.html
@@ -62,6 +62,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -88,6 +91,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -174,7 +180,7 @@
diff --git a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Structs.html b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Structs.html
index 8529635d..4af3de12 100644
--- a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Structs.html
+++ b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Structs.html
@@ -61,6 +61,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -87,6 +90,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -155,7 +161,7 @@
-
A strucutre which provides information about gzip archive.
+
A structure which provides information about gzip archive.
See more
@@ -168,7 +174,7 @@
@@ -190,7 +196,7 @@
-
A strucutre which provides information about zlib archive.
+
A structure which provides information about zlib archive.
See more
@@ -203,7 +209,7 @@
diff --git a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Structs/GzipHeader.html b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Structs/GzipHeader.html
index 6a8090da..b8746b3d 100644
--- a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Structs/GzipHeader.html
+++ b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Structs/GzipHeader.html
@@ -62,6 +62,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -88,6 +91,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -140,7 +146,7 @@
- A strucutre which provides information about gzip archive.
+ A structure which provides information about gzip archive.
@@ -175,7 +181,7 @@
@@ -206,7 +212,7 @@
@@ -236,7 +242,7 @@
@@ -266,7 +272,7 @@
@@ -296,7 +302,7 @@
@@ -326,7 +332,7 @@
@@ -356,7 +362,7 @@
@@ -421,7 +427,7 @@ it might not be compressed with gzip at all.
diff --git a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Structs/GzipHeader/CompressionMethod.html b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Structs/GzipHeader/CompressionMethod.html
index 8413dd76..203fa4c1 100644
--- a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Structs/GzipHeader/CompressionMethod.html
+++ b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Structs/GzipHeader/CompressionMethod.html
@@ -62,6 +62,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -88,6 +91,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -174,7 +180,7 @@
diff --git a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Structs/GzipHeader/FileSystemType.html b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Structs/GzipHeader/FileSystemType.html
index 73f0fd1a..59859573 100644
--- a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Structs/GzipHeader/FileSystemType.html
+++ b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Structs/GzipHeader/FileSystemType.html
@@ -62,6 +62,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -88,6 +91,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -174,7 +180,7 @@
@@ -208,7 +214,7 @@
@@ -242,7 +248,7 @@
@@ -276,7 +282,7 @@
@@ -310,7 +316,7 @@
diff --git a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Structs/ZlibHeader.html b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Structs/ZlibHeader.html
index 5f6bb135..ea7ac348 100644
--- a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Structs/ZlibHeader.html
+++ b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Structs/ZlibHeader.html
@@ -62,6 +62,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -88,6 +91,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -140,7 +146,7 @@
- A strucutre which provides information about zlib archive.
+ A structure which provides information about zlib archive.
@@ -175,7 +181,7 @@
@@ -206,7 +212,7 @@
@@ -236,7 +242,7 @@
@@ -266,7 +272,7 @@
@@ -296,7 +302,7 @@
@@ -361,7 +367,7 @@ it might not be compressed with zlib at all.
diff --git a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Structs/ZlibHeader/CompressionLevel.html b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Structs/ZlibHeader/CompressionLevel.html
index a6b0c64e..b0ed94fa 100644
--- a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Structs/ZlibHeader/CompressionLevel.html
+++ b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Structs/ZlibHeader/CompressionLevel.html
@@ -62,6 +62,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -88,6 +91,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -174,7 +180,7 @@
@@ -208,7 +214,7 @@
@@ -242,7 +248,7 @@
@@ -276,7 +282,7 @@
diff --git a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Structs/ZlibHeader/CompressionMethod.html b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Structs/ZlibHeader/CompressionMethod.html
index 192fabd2..21086040 100644
--- a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Structs/ZlibHeader/CompressionMethod.html
+++ b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/Structs/ZlibHeader/CompressionMethod.html
@@ -62,6 +62,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -88,6 +91,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -174,7 +180,7 @@
diff --git a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/index.html b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/index.html
index 2d7203da..23e1202d 100644
--- a/docs/docsets/SWCompression.docset/Contents/Resources/Documents/index.html
+++ b/docs/docsets/SWCompression.docset/Contents/Resources/Documents/index.html
@@ -61,6 +61,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -87,6 +90,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -161,6 +167,11 @@ And yes, it is also in Objective-C.
Features
+Containers:
+
+
+ZIP (complying to ISO/IEC 21320 standard)
+
(De)compression algorithms:
diff --git a/docs/docsets/SWCompression.docset/Contents/Resources/docSet.dsidx b/docs/docsets/SWCompression.docset/Contents/Resources/docSet.dsidx
index a12e6151..8536ab2c 100644
Binary files a/docs/docsets/SWCompression.docset/Contents/Resources/docSet.dsidx and b/docs/docsets/SWCompression.docset/Contents/Resources/docSet.dsidx differ
diff --git a/docs/docsets/SWCompression.tgz b/docs/docsets/SWCompression.tgz
index 61602516..f6823754 100644
Binary files a/docs/docsets/SWCompression.tgz and b/docs/docsets/SWCompression.tgz differ
diff --git a/docs/index.html b/docs/index.html
index 2d7203da..23e1202d 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -61,6 +61,9 @@
XZArchive
+
+ ZipContainer
+
ZlibArchive
@@ -87,6 +90,9 @@
XZError
+
+ ZipError
+
ZlibError
@@ -161,6 +167,11 @@ And yes, it is also in Objective-C.
Features
+Containers:
+
+
+ZIP (complying to ISO/IEC 21320 standard)
+
(De)compression algorithms: