With any GZip format stream you are guarnateed:
First two bytes: 1f
, 8b
Next byte: 00
for store (no compression), 01
for compress algorithm, 02
for pack, 03
for lzf and 08
for deflate. .NET so-far always uses deflate and many situations expect only deflate (only deflate-based gzip is expected by web clients as a transfer or content encoding marked as gzip
) so it would be unlikely to change without some sort of option to specify it being added.
The next is the file type, with 00
meaning "probably some sort of text file" Since GZipStream
has no information on the file type, it always uses that.
The next four are file-modification time in Unix format. Again, since the class has no information about the file–as it receives a stream, not a file with metadata, these are always set to 0.
The next byte depends on the compression method. With deflate
it could be 2
to indicate heavy compression or 4
to indicate light compression.
The next (last in your sequence) depends on the OS type in use. 0
means "FAT Filesystem" but has continued to be used by Windows as Windows has moved to use other file systems like NTFS. It could potentially have a different value if used with Mono on a non-Windows file system, though that situation could also potentially decide to match the .NET behaviour. (Update: At least some versions of Mono will set the file-system flag to something other than 0
on non-Windows systems).