-
Notifications
You must be signed in to change notification settings - Fork 485
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support added for TAR LZW compression (Unix 'compress' resulting in .…
…Z files)
- Loading branch information
1 parent
bcb61ee
commit 02301ec
Showing
8 changed files
with
688 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,5 +15,6 @@ public enum CompressionType | |
Xz, | ||
Unknown, | ||
Deflate64, | ||
Shrink | ||
Shrink, | ||
Lzw | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
namespace SharpCompress.Compressors.Lzw | ||
{ | ||
/// <summary> | ||
/// This class contains constants used for LZW | ||
/// </summary> | ||
[System.Diagnostics.CodeAnalysis.SuppressMessage( | ||
"Naming", | ||
"CA1707:Identifiers should not contain underscores", | ||
Justification = "kept for backwards compatibility" | ||
)] | ||
public sealed class LzwConstants | ||
{ | ||
/// <summary> | ||
/// Magic number found at start of LZW header: 0x1f 0x9d | ||
/// </summary> | ||
public const int MAGIC = 0x1f9d; | ||
|
||
/// <summary> | ||
/// Maximum number of bits per code | ||
/// </summary> | ||
public const int MAX_BITS = 16; | ||
|
||
/* 3rd header byte: | ||
* bit 0..4 Number of compression bits | ||
* bit 5 Extended header | ||
* bit 6 Free | ||
* bit 7 Block mode | ||
*/ | ||
|
||
/// <summary> | ||
/// Mask for 'number of compression bits' | ||
/// </summary> | ||
public const int BIT_MASK = 0x1f; | ||
|
||
/// <summary> | ||
/// Indicates the presence of a fourth header byte | ||
/// </summary> | ||
public const int EXTENDED_MASK = 0x20; | ||
|
||
//public const int FREE_MASK = 0x40; | ||
|
||
/// <summary> | ||
/// Reserved bits | ||
/// </summary> | ||
public const int RESERVED_MASK = 0x60; | ||
|
||
/// <summary> | ||
/// Block compression: if table is full and compression rate is dropping, | ||
/// clear the dictionary. | ||
/// </summary> | ||
public const int BLOCK_MODE_MASK = 0x80; | ||
|
||
/// <summary> | ||
/// LZW file header size (in bytes) | ||
/// </summary> | ||
public const int HDR_SIZE = 3; | ||
|
||
/// <summary> | ||
/// Initial number of bits per code | ||
/// </summary> | ||
public const int INIT_BITS = 9; | ||
|
||
private LzwConstants() { } | ||
} | ||
} |
Oops, something went wrong.