[
  {
    "Id": "187812",
    "ThreadId": "55616",
    "Html": "Hi Cheeso,<br>\r\n<br>\r\nI tried searching the discussions before posting this and didn't find anything.<br>\r\n<br>\r\nWhat I'm basically looking for is compressing one file; similar to the System.IO.Compression.GZipStream. I would use the System.IO.Compress.GZipStream, but it is too unpredictable and unreliable. <br>\r\nI used the Ionic.Zlib.ZlibStream to compress a file, but when I looked at the header, it didn't match that of the GZipStream. <br>\r\n<br>\r\nI am assuming that this functionality exists in DotNetZip and was wondering if you would kindly point me to the correct classes. <br>\r\n<br>\r\nThe use application for me is a result from sending files to a hardware device that support gZip (decompress only). The firmware on the device I am sending files to expect the headers of 1F 8B 08 08.<br>\r\n<br>\r\nThank you<br>\r\nkind regards,<br>\r\n<br>\r\nGreg \r\n",
    "PostedDate": "2009-05-07T11:10:28.363-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "187828",
    "ThreadId": "55616",
    "Html": "Whoa!  Ionic.Zlib.GZipStream is unreliable and unpredictable? <br>\r\nIf so, I should fix it. <br>\r\nhave you logged work items?  Do I have details? <br>\r\n<br>\r\nIf you want a GZIP stream, then the thing you are asking for is the Ionic.Zlib.GZipStream. The ZlibStream compresses in a different way.  Likewise the DeflateStream.  The compression formats are described in RFC <a href=\"http://www.ietf.org/rfc/rfc1950.txt\">1950 [ZLIB]</a>, <a href=\"http://www.ietf.org/rfc/rfc1951.txt\">1951 [DEFLATE]</a>, and <a href=\"http://www.ietf.org/rfc/rfc1952.txt\">1952 [GZIP]</a>.  <br>\r\n<br>\r\nWithout consulting those RFCs, I don't know, off the top of my head, what the required file header is for GZIP.  If the bytestream you listed is required by the GZIP spec then those bytes are the ones the library will emit, when using GZipStream.  If the required bytes are not being emitted, then I need to fix the library.  <br>\r\n<br>\r\n",
    "PostedDate": "2009-05-07T12:02:55.2-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "187834",
    "ThreadId": "55616",
    "Html": "Just had a quick look at the spec.  The 0x1f 0x8b is a standard GZIP header.  The next byte indicates the compression method - 0x08 implies DEFLATE, which is what Ionic.Zlib.GZipStream will produce.  The next byte is the flag byte and indicates whether the file metadata contains various optional parts.  0x08 in that byte indicates the filename must be present in the GZIP metadata.  To make this happen you can set the FileName property on the GZipStream.  <br>\r\n<br>\r\nI just looked at the doc on Ionic.Zip.GZipStream and it is less than clear that the FileName property is optional. And it is also not stated that setting the filename will turn on bit 3 in the flag byte.    <a href=\"http://cheeso.members.winisp.net/DotNetZipHelp/html/c23ed47b-99bc-5c04-cfa9-619d238f4aaf.htm\">http://cheeso.members.winisp.net/DotNetZipHelp/html/c23ed47b-99bc-5c04-cfa9-619d238f4aaf.htm</a>  But as I recall, I designed it so that if you set the filename then bit 3 of the flag byte automatically gets set.  In the absence of other optional stuff (comments, Extra data, etc), the flag byte will be 0x08, which is what you said you want. <br>\r\n<br>\r\nTo sum it up, if you are using GZipStream to write a blob to be consumed for this device, and the device expects 0x1F 0x8B 0x08 ox08 as header bytes, then I suggest you set the FileName property on the GZipStream instance before calling Write() for the first time on the instance. <br>\r\n",
    "PostedDate": "2009-05-07T12:15:17.42-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "187839",
    "ThreadId": "55616",
    "Html": "Hi Cheeso,<br>\r\n<br>\r\nI think I must have mistyped what I was trying to convey. The Microsoft System.IO.Compression.GZipStream is unreliable. If I compress a simple bitmap with only 128 colors, (Original size 1.1MB), using Microsoft's GZipStream compresses it down to 856kb, whereas using the Ionic.Zlib.ZlibStream compresses the same bitmap down to 552kb. WinZip compresses the same bitmap down to 552kb. <br>\r\n<br>\r\nIn my humble opinion, the DonNetZip library rocks! I havn't had any problems with it whatsoever. Excellent effort; thank you for the contribution. <br>\r\n<br>\r\nI will try what you have suggested and post my findings.<br>\r\n<br>\r\nAgain, thank you.<br>\r\n<br>\r\nGreg\r\n",
    "PostedDate": "2009-05-07T12:25:24.51-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "187845",
    "ThreadId": "55616",
    "Html": "How embarrasing for me... I feel silly now.<br>\r\n<br>\r\nI just realized taht I am using DNZ 1.7.2.16 instead of 1.8, which is why I couldn't locate GZipStream. I think its clear that I'm due for a vacation.  :)<br>\r\n<br>\r\nGreg \r\n",
    "PostedDate": "2009-05-07T12:39:20.15-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "187849",
    "ThreadId": "55616",
    "Html": "Ah, I misunderstood. <br>\r\nAnd yes, as you realized, the GZipStream class is new in DotNetZip for v1.8. <br>\r\nIt should do what you want !\r\n",
    "PostedDate": "2009-05-07T12:44:17.82-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]