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 8902473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:37:19+00:00 2026-06-15T01:37:19+00:00

The deflate function of zlib accepts a Z_FULL_FLUSH option as its argument, as far

  • 0

The deflate function of zlib accepts a Z_FULL_FLUSH option as its argument, as far as I know, when full flush is performed, a full flush point (0,0,0xFF,0xFF) will be set, subsequent data will be independent from the bytes precedes that point, hence makes the compressed data quasi random accessible. I’ve read a little bit source of dictzip, it took advantage of this feature to implement its chunk-wise random-accessibility, yet kept the compatibility with gzip. I want to reimplement dictzip compressor/decompressor using CLR provided functionality. The decompressor (random parts reader) is easy, I can just use the DeflateStream to decompress the data chunk by chunk, with no problem, but as for the creation, there is a huge obstacle, the API of DeflateStream is too high-level, it seems all deflate details are hidden, hence unexploitable. I really don’t like to include a C shared library in my C# project, it makes the cross-platform deployment very painful, and cancels the benefits of choosing coding in C# in the first place. So, what should I do? Is there any way I can circumvent this obstacle merely using managed code? Does Mono provide a lower-level wrapper for zlib so that I can call deflate with full flush option? Any advice will be appreciated!

— >8 —

Thanks to Mark Adler who provided the answer. DotNetZip (specifically Ionic.Zlib.DeflateStream) supports exactly the feature I was asking for. The following example shows how it works:

        Encoding u8 = Encoding.UTF8;
        byte[]  s1 = u8.GetBytes("the quick brown fox "),
                s2 = u8.GetBytes("jumps over the lazy dog!");
        var ms = new MemoryStream(100);
        var deflator = new DeflateStream(ms, CompressionMode.Compress, true);
        deflator.FlushMode = FlushType.Full;
        deflator.Write(s1, 0, s1.Length);
        deflator.Flush();
        var pos = ms.Position;//remember the full flush point
        deflator.Write(s2, 0, s2.Length);
        deflator.Dispose();

        var inflator = new DeflateStream(ms, CompressionMode.Decompress);
        ms.Position = pos;
        byte[] buf = new byte[100];
        inflator.Read(buf, 0, s2.Length);
        Console.WriteLine(u8.GetString(buf));//output: jumps over the lazy dog!
  • 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-06-15T01:37:20+00:00Added an answer on June 15, 2026 at 1:37 am

    Try DotNetZip. SO won’t let me post less than 30 characters, even though that is a complete and correct answer, so I added this extraneous sentence.

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

Sidebar

Related Questions

We already know deflate encoding is a winner over gzip with respect to speed
I'm trying to use Zlib::Deflate.deflate on a massive file (4 gigs). There are obvious
We have a function in our Rails code that accepts a JSON POST body:
For some reason, the zlib.deflate filter doesn't seem to be working with socket pairs
this is my javascript: function getWeather() { $.getJSON('getTemperature/' + $('.data option:selected').val(), null, function(data) {
I'm trying to deflate and inflate a text file using zlib-1.2.7 with VC++2010. I
After making a gzip deflate request in PHP, I receive the deflated string in
I'm interested on documentation of the deflate stream format or deflate algorithm which goes
According to wiki the compressed data in deflate and gzip are the same. the
Can anyone tell me the difference between using mod_deflate and zlib output_compression? I understand

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.