- Archive classes allow random access to a seekable stream.
- Reader classes allow forward-only reading on a stream.
- Writer classes allow forward-only Writing on a stream.
Archive Format | Compression Format(s) | Compress/Decompress | Archive API | Reader API | Writer API |
---|---|---|---|---|---|
Rar | Rar | Decompress (1) | RarArchive | RarReader | N/A |
Zip (2) | None, DEFLATE, BZip2, LZMA/LZMA2, PPMd | Both | ZipArchive | ZipReader | ZipWriter |
Tar | None | Both | TarArchive | TarReader | TarWriter (3) |
Tar.GZip | DEFLATE | Both | TarArchive | TarReader | TarWriter (3) |
Tar.BZip2 | BZip2 | Both | TarArchive | TarReader | TarWriter (3) |
Tar.LZip | LZMA | Both | TarArchive | TarReader | TarWriter (3) |
Tar.XZ | LZMA2 | Decompress | TarArchive | TarReader | TarWriter (3) |
GZip (single file) | DEFLATE | Both | GZipArchive | GZipReader | GZipWriter |
7Zip (4) | LZMA, LZMA2, BZip2, PPMd, BCJ, BCJ2, Deflate | Decompress | SevenZipArchive | N/A | N/A |
LZip (single file) (5) | LZip (LZMA) | Both | LZipArchive | LZipReader | LZipWriter |
- SOLID Rars are only supported in the RarReader API.
- Zip format supports pkware and WinzipAES encryption. However, encrypted LZMA is not supported. Zip64 reading/writing is supported but only with seekable streams as the Zip spec doesn't support Zip64 data in post data descriptors.
- The Tar format requires a file size in the header. If no size is specified to the TarWriter and the stream is not seekable, then an exception will be thrown.
- The 7Zip format doesn't allow for reading as a forward-only stream so 7Zip is only supported through the Archive API
- LZip has no support for extra data like the file name or timestamp. There is a default filename used when looking at the entry Key on the archive.
For those who want to directly compress/decompress bits. The single file formats are represented here as well. However, BZip2, LZip and XZ have no metadata (GZip has a little) so using them without something like a Tar file makes little sense.
Compressor | Compress/Decompress |
---|---|
BZip2Stream | Both |
GZipStream | Both |
DeflateStream | Both |
LZMAStream | Both |
PPMdStream | Both |
ADCStream | Decompress |
LZipStream | Both |
XZStream | Decompress |
Sometimes the terminology gets mixed.
DEFLATE, LZMA are pure compression algorithms
Formats like Zip, 7Zip, Rar are archive formats only. They use other compression methods (e.g. DEFLATE, LZMA, etc.) or propriatory (e.g RAR)
GZip, BZip2 and LZip are single file archival formats. The overlap in the API happens because Tar uses the single file formats as "compression" methods and the API tries to hide this a bit.