Home Forums .NET libraries Xceed Zip & Real-Time Zip for .NET Reading gzipped stream using gzip.org binaries?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #19717 |

    Hi,

    I’m evaluating Xceed Zip for .NET, but I’m having a small problem…

    When trying to store a gzipped-compressed stream to a disk file:

    // compress data byte array
    using (MemoryStream destinationStream = new MemoryStream())
    {
    using (GZipCompressedStream standard = new GZipCompressedStream(destinationStream, CompressionLevel.Highest))
    {
    standard.Write(data, 0, data.Length);
    }
    // save compressed memory stream to disk file
    FileStream fs = File.Create(filepath);
    byte[] compressedData = destinationStream.ToArray();
    fs.Write(compressedData, 0, compressedData.Length);
    fs.Close();
    }

    The file is stored just fine and I can read/decompress the stream just fine using the Xceed GZipCompressedStream object…

    but I CAN’T seem to open the resulting compressed file successfully using WinRAR, WinZip, or gzip.org’s compression utilities. My data stream is there, but every other byte in the output file is a null character, so “Mary had a little lamb” becomes “M a r y h a d a l i t t l e l a m b” in the output. This doesn’t happen when I decompress the stream using the Xceed components.

    Is ther some mistake I am making when I compress the stream?

    Shouldn’t third-party gzip-compatible software be able to read data compressed by Xceed components?

    This is a very important requirement for our purposes.

    Best Regards,

    David Montgomery

    Imported from legacy forums. Posted by David (had 2003 views)

    User (Old forums)
    Member
    Post count: 23064

    Using the GZipCompressedStream class will generate raw compressed data. This does not produce a GZip formatted file. This is why WinZip or WinRar will not be able to open it. You will need to use classes included in Xceed.GZip.dll (i.e. GZipArchive, GZippedFolder, GZippedFile) to generate a file readable by WinRar and such utilities.

    You can look at our code sample explorer to see how to use these classes :

    Stat Menu -> All Programs -> Xceed Component -> Our Components in Action ! -> File System Snippet Explorer.

    Then click on topic “5. Tar and GZip capabilities”. In the sub topics, you can look at the C# or VB.NET code, you can execute it, and you can even modify the code and execute it after.

    Imported from legacy forums. Posted by André (had 3180 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.