Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 393649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T16:16:43+00:00 2026-05-12T16:16:43+00:00

I can’t seem to get a stream that Flex 3 want’s to decompress. I’ve

  • 0

I can’t seem to get a stream that Flex 3 want’s to decompress.

I’ve tried:

  • System.IO.Compression.GZipStream
  • System.IO.Compression.DeflateStream
  • ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream
  • zlib.ZOutputStream

None of these seem to make ByteArray.uncompress happy, i.e. I get

Error #2058: There was an error decompressing the data.

Also the whole Deflate vs zlib has me going around in circles.

It seems that according to the wikipedia article, zlib is an implementation of DEFLATE. But according to Actionscript they are two different things?

Microsoft also seems to indicate the Gzip at least uses the Deflate algorithm, as in their docs they refer that GZipOutputStream uses the same compression algorithm as DeflateStream. So I’m assuming that it’s just a header difference, which would indicate that’s “no good” as far as ‘ByteArray.uncompress’ as the “DEFLATE” algorithm is only supported in AIR applications.

Sample “server” code, using SharpZipLib in this case (not working):

    public virtual bool ProcessRequest(string path, HttpListenerContext context)
    {
        var buffer = File.ReadAllBytes(path);
        // Specifying to strip header/footer from data as that seems to be what the
        // docs for ByteArray.uncompress indicate is necessary 
        var deflater = new Deflater(Deflater.DEFAULT_COMPRESSION, true); 
        using (var zipStream = new DeflaterOutputStream(context.Response.OutputStream, deflater))
        {
            zipStream.Write(buffer, 0, buffer.Length);
        }
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T16:16:43+00:00Added an answer on May 12, 2026 at 4:16 pm

    ZLIB and DEFLATE are not the same. There is a set of 3 related compression specs defined in IETF RFCs:

    • RFC 1950, ZLIB
    • RFC 1951, DEFLATE
    • RFC 1952, GZIP

    They all use (mostly) a particular compression algorithm, which is DEFLATE.

    How ZLIB Relates to DEFLATE

    The first, ZLIB, includes framing bytes in the beginning. According to RFC 1950…

      A zlib stream has the following structure:
    
           0   1
         +---+---+
         |CMF|FLG|   (more-->)
         +---+---+
    
      (if FLG.FDICT set)
    
           0   1   2   3
         +---+---+---+---+
         |     DICTID    |   (more-->)
         +---+---+---+---+
    
         +=====================+---+---+---+---+
         |...compressed data...|    ADLER32    |
         +=====================+---+---+---+---+
    

    CMF and FLG are bytes. As the spec says, the primary compression method used in ZLIB is DEFLATE, though the spec could be used with other methods. In general it isn’t. Also, the DICTID is generally not used. Therefore every ZLIB bytestream has 2 bytes, followed by a stream of compressed data, followed by an Adler32 checksum. The compressed data is a bare stream of bytes from DEFLATE.

    How GZIP Relates to DEFLATE

    That takes care of how ZLIB differs from DEFLATE, as a format. GZIP is a third format. If you want the details, check the RFC. The key things are that like ZLIB, GZIP primarily uses DEFLATE and it puts a header prior to the compressed datastream, and a checksum afterwards. But the GZIP header is different than the ZLIB header, so any GZipStream class is not going to be able to write a stream of bytes that will be readable as ZLIB. And vice versa.

    Solving the problem

    When reading a ZLIB Stream, some people address the problem you experienced by using .NET’s built-in DeflateStream on the datastream, after advancing the stream past the first two ZLIB framing bytes. This works, as long as you want to READ, the ZLIB stream uses DEFLATE (safe assumption) and it does not define a fixed dictionary (also pretty safe), and if you don’t care about the integrity check provided by the Adler32 (maybe).

    If you don’t like making those assumptions or giving up the check, or if you have to generate a a ZLIB data stream, there’s a ZlibStream in DotNetZip that will read and write ZLIB data streams for you, and verify or produce the checksum as necessary.

    DotNetZip is free to use, works with any .NET language. You don’t need the full DotNetZip library, instead you just need the Ionic.Zlib.dll .

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can't seem to get the Back Button to appear in a UINavigationController flow. I
Can someone guide me on a possible solution? I don't want to use /bin/cp
Can somebody point me to a resource that explains how to go about having
Can a LINQ enabled app run on a machine that only has the .NET
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Can anyone help me with an excel formula that groups related rows and creates
can someone show me the regex for this preg_match. I want to make sure
Can i get the source code for a WAMP stack installer somewhere? Any help
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
Can somebody tell me how to get mod_rewrite to rename this: our-work-section.php?id=3&title=something to our-work-section/something/3

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.