See the following stackoverflow thread for more information.
GZipStream currently fails if you try to decompress a concatenated gzip file. The RFC does state that two gzip files can be cated together and it is also a valid gzip file. However, the current implementation can only read the first gzip stream and stops there. Here is a simple repro::
using System;
using System.IO;
using System.IO.Compression;
class Program
{
static void Main()
{
using (var fs = new FileStream(Path.Combine(Environment.CurrentDirectory,"test.txt.gz"), FileMode.Create))
{
using(var gz = new GZipStream(fs, CompressionLevel.NoCompression, true))
using(var sw = new StreamWriter(gz))
sw.WriteLine("Stream 1");
using(var gz = new GZipStream(fs, CompressionLevel.NoCompression, true))
using(var sw = new StreamWriter(gz))
sw.WriteLine("Stream 2");
fs.Seek(0, SeekOrigin.Begin);
using (var gz = new GZipStream(fs, CompressionMode.Decompress))
using (var sr = new StreamReader(gz))
Console.WriteLine(sr.ReadToEnd());
}
}
}
The expected output should be
But the actual output is just Stream 1.
If you open up "test.txt.gz" in your favorite gzip util, like 7z, you will be able to extract the file and you will see the correct output.
See the following stackoverflow thread for more information.
GZipStream currently fails if you try to decompress a concatenated gzip file. The RFC does state that two gzip files can be cated together and it is also a valid gzip file. However, the current implementation can only read the first gzip stream and stops there. Here is a simple repro::
The expected output should be
But the actual output is just
Stream 1.If you open up "test.txt.gz" in your favorite gzip util, like 7z, you will be able to extract the file and you will see the correct output.