forked from icsharpcode/SharpZipLib
/
GZipConstants.cs
78 lines (68 loc) · 1.6 KB
/
GZipConstants.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
using System;
using System.Text;
namespace ICSharpCode.SharpZipLib.GZip
{
/// <summary>
/// This class contains constants used for gzip.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "kept for backwards compatibility")]
sealed public class GZipConstants
{
/// <summary>
/// First GZip identification byte
/// </summary>
public const byte ID1 = 0x1F;
/// <summary>
/// Second GZip identification byte
/// </summary>
public const byte ID2 = 0x8B;
/// <summary>
/// Deflate compression method
/// </summary>
public const byte CompressionMethodDeflate = 0x8;
/// <summary>
/// Get the GZip specified encoding (CP-1252 if supported, otherwise ASCII)
/// </summary>
public static Encoding Encoding
{
get
{
try
{
return Encoding.GetEncoding(1252);
}
catch
{
return Encoding.ASCII;
}
}
}
}
/// <summary>
/// GZip header flags
/// </summary>
[Flags]
public enum GZipFlags: byte
{
/// <summary>
/// Text flag hinting that the file is in ASCII
/// </summary>
FTEXT = 0x1 << 0,
/// <summary>
/// CRC flag indicating that a CRC16 preceeds the data
/// </summary>
FHCRC = 0x1 << 1,
/// <summary>
/// Extra flag indicating that extra fields are present
/// </summary>
FEXTRA = 0x1 << 2,
/// <summary>
/// Filename flag indicating that the original filename is present
/// </summary>
FNAME = 0x1 << 3,
/// <summary>
/// Flag bit mask indicating that a comment is present
/// </summary>
FCOMMENT = 0x1 << 4,
}
}