Quantcast
Channel: SharpDevelop Community
Viewing all articles
Browse latest Browse all 1764

"GZIP crc sum mismatch" when decompressing

$
0
0

Hey there,

I'm getting the following error when trying to decompress a byte array:

GZipException: GZIP crc sum mismatch, theirs "-1419322270" and ours "574414146

ICSharpCode.SharpZipLib.GZip.GZipInputStream.ReadFooter ()

ICSharpCode.SharpZipLib.GZip.GZipInputStream.Read (System.Byte[ buffer, Int32 offset, Int32 count)


Here's the function that's returning the error:

private const int BUFFER_SIZE = 4096;

public string GetDecompressedJson(bytecompressedBytes)
{
    using (GZipInputStream stream = new GZipInputStream(new MemoryStream(compressedBytes)))
    {
        bytebuffer = new byte[BUFFER_SIZE];

        using (MemoryStream ms = new MemoryStream())
        {
            int size = 0;
            do
            {
                size = stream.Read(buffer0BUFFER_SIZE);
                if (count > 0)
                {
                    ms.Write(buffer0count);
                }
            }
            while (size > 0);

            ms.Position = 0;
            StreamReader sr = new StreamReader(msEncoding.UTF8);
            string json = sr.ReadToEnd();
            
            return json;
        }
    }
}

The gzip file was made with gzip 1.3.12.  Could someone tell me if I'm doing the decompression incorrectly or if there might be something wrong with my gzip file? Using SharpZipLib_0860

Thanks!
bread 


Viewing all articles
Browse latest Browse all 1764

Trending Articles