[
  {
    "Id": "250670",
    "ThreadId": "73357",
    "Html": "<p>Hi,</p>\r\n<p>I want to continue&nbsp;an old discussion, about compressing strings.</p>\r\n<p><a href=\"http://dotnetzip.codeplex.com/Thread/View.aspx?ThreadId=65854\">http://dotnetzip.codeplex.com/Thread/View.aspx?ThreadId=65854</a></p>\r\n<p>My problem is when I call GZipStream.CompressString under CF2 and WM6, I get TypeLoadException.</p>\r\n<p>GZipStream.CompressString(s1)<br>e.Message=TypeLoadException</p>\r\n<p>stack trace=<br>at cfzipTest.Form1.CompressTest()<br>at cfzipTest.Form1.button1_Click()<br>at System.Windows.Forms.Control.OnClick()<br>at System.Windows.Forms.Button.OnClick()<br>at System.Windows.Forms.ButtonBase.WnProc()<br>at System.Windows.Forms.Control._InternalWnProc()<br>at Microsoft.AGL.Forms.EVL.EnterMainLoop()<br>at System.Windows.Forms.Application.Run()<br>at cfzipTest.Program.Main()</p>\r\n<p>I try to replace&nbsp; the call to ZlibStream.CompressString, and got NotSupportedException.</p>\r\n<p>ZlibStream.CompressString(s1)<br>e.Message=NotSupportedException</p>\r\n<p>stack trace=<br>at System.RuntimeType.InvokeMember()<br>at System.Type.InvokeMember()<br>at Ionic.Zlib.ZlibBaseStream.CompressString()<br>at Ionic.Zlib.ZlibStream.CompressString()<br>at cfzipTest.Form1.CompressTest()<br>at cfzipTest.Form1.button4_Click()<br>at System.Windows.Forms.Control.OnClick()<br>at System.Windows.Forms.Button.OnClick()<br>at System.Windows.Forms.ButtonBase.WnProc()<br>at System.Windows.Forms.Control._InternalWnProc()<br>at Microsoft.AGL.Forms.EVL.EnterMainLoop()<br>at System.Windows.Forms.Application.Run()<br>at cfzipTest.Program.Main()</p>\r\n<p>the same exception i got with calling DeflateStream.CompressString.</p>\r\n<p>&nbsp;</p>\r\n<p>At one of the discussions you wrote that the WM5 does not contains the requeired iso-8859-1 code page. so I try to call that function at CE5 mobile with CF2, and everyone of the calls got the NotSupportedException exception.</p>\r\n<p>with the stack trace=<br>at System.RuntimeType.InvokeMember()<br>at System.Type.InvokeMember()<br>at Ionic.Zlib.ZlibBaseStream.CompressString()<br>at Ionic.Zlib.ZlibStream.CompressString()<br>at cfzipTest.Form1.CompressTest()<br>at cfzipTest.Form1.button4_Click()<br>at System.Windows.Forms.Control.OnClick()<br>at System.Windows.Forms.Button.OnClick()<br>at System.Windows.Forms.ButtonBase.WnProc()<br>at System.Windows.Forms.Control._InternalWnProc()<br>at Microsoft.AGL.Forms.EVL.EnterMainLoop()<br>at System.Windows.Forms.Application.Run()<br>at cfzipTest.Program.Main()</p>\r\n<p>I use the latest version of the v1.8 kit. v1.8.4.26</p>\r\n<p>&nbsp;</p>\r\n<p>What did i miss?</p>\r\n<p>&nbsp;</p>\r\n<p>sorry for the long time from my latest&nbsp;response ...</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2009-10-28T06:59:39.887-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "250822",
    "ThreadId": "73357",
    "Html": "<p>You didn't miss anything.&nbsp; I missed something.&nbsp; I used the Type.InvokeMember method, which is not supported on the CompactFramework, and I didn't test it. &nbsp;</p>\r\n<p>It throws an exception, always.&nbsp;</p>\r\n<p>The fix is easy.&nbsp; I'll put it together and upload it.</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2009-10-28T12:02:31.91-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "250858",
    "ThreadId": "73357",
    "Html": "<p>I just posted an update of v1.8: v1.8.4.27.&nbsp; &nbsp; It's a very small change so I would suggest that you update right away.&nbsp; The DeflateStream.CompressString() should work for you now.&nbsp; Also ZlibStream.CompressString() should work.</p>\r\n<p>GZipStream.CompressString() will still fail because of the iso-8859-1 platform issue.</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2009-10-28T13:03:41.117-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "251104",
    "ThreadId": "73357",
    "Html": "<p>They both works fine !</p>\r\n<p>for my basic tests, the DeflateStream.CompressString generate smaller byte array than ZlibStream.CompressString(). by a few bytes (for 30K string length). is there any other considerations (than size) i should take for selecting/using one of those methods?</p>\r\n<p>Thanks !</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2009-10-29T03:23:28.187-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "251126",
    "ThreadId": "73357",
    "Html": "<p>Thanks for testing it. I'm glad it's working for you.</p>\r\n<p>You asked about considerations for choosing ZLIB versus DEFLATE.&nbsp; The short answer is, in your case, it probably doesn't matter which you choose.&nbsp; &nbsp;If I were selecting a compression algorithm for general purpose use, I would select ZLIB.</p>\r\n<p>The ZLIB compression uses the same compression algorithm as DEFLATE.&nbsp; The difference is, ZLIB adds extra &quot;metadata&quot; around the DEFLATE'd data.&nbsp; If you stripped off that metadata, or data about the data, then you would be left with the identical DEFLATE stream.&nbsp;&nbsp; The purpose of the ZLIB metadata is to provide extra services or capabilities.&nbsp; If you care, you can read <a href=\"http://www.faqs.org/rfcs/rfc1950.html\">IETF RFC 1950</a>&nbsp;to learn specifically what ZLIB adds.&nbsp; There are a bunch of options that are not actually used in practice. For example, the compression method.&nbsp; In theory ZLIB can be used with one of a number of compression methods.&nbsp; In practice, ZLIB always uses DEFLATE.&nbsp; As a result, much of the ZLIB metadata is of no practical value.&nbsp;</p>\r\n<p>There's&nbsp;one possibly interesting piece of ZLIB metadata: the Adler32 checksum.&nbsp; This provides a data integrity check that you do not get with DEFLATE alone.&nbsp;A DEFLATE stream is fairly fragile - if you change one byte of the compressed data, your decompression is likely to fail in an obvious manner.&nbsp; But it's theoretically possible to have corruption in the deflate'd stream of data, that results in a valid deflate stream.&nbsp; When you decompress the corrupted data, you get a valid output - no errors during decompression - though because of the upstream corruption, the resulting decompressed text does not match the original.&nbsp;&nbsp;</p>\r\n<p>To avoid this problem, ZLIB has a checksum that will detect corruption, even if the compressed stream decompresses without error. A compliant ZLIB processor (such as is included in DotNetZip) must throw an error if the checksum does not match.</p>\r\n<p>It's going to be a rare case, though.&nbsp; In most cases if there is corruption in the compressed data, it will not decompress properly - you'll get an error even without the checksum verification.&nbsp; On the other hand, because ZLIB implies such a small amount of overhead, in the general case, it's worth it to have the extra protection.&nbsp; Finally, in specific applications, you may not need or not want the ZLIB checksum.&nbsp;For example, in a .zip file, DEFLATE is just fine because there is a separate, zip-specific checksum on each DEFLATE stream.</p>\r\n<p>Probably more information than you wanted.&nbsp; Sometimes I can't help mesef.</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2009-10-29T05:04:07.22-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "252335",
    "ThreadId": "73357",
    "Html": "<p>Hi again,</p>\r\n<p>I don't know if it supose to be like that, but when i'm using DeflateStream.CompressString on small strings (mine is an empty XML, &quot;&lt;ALL&gt;&lt;/ALL&gt;&quot;), the DeflateStream.UncompressString return empty string. No exception.</p>\r\n<p>The ZlibStream.CompressString and ZlibStream.UncompressString works fine.</p>\r\n<p>Is it part of the fragility of the DeflateStream?</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2009-11-02T02:22:01.187-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "252340",
    "ThreadId": "73357",
    "Html": "<p>No, it should not do that.&nbsp; Sounds like a problem to me.</p>",
    "PostedDate": "2009-11-02T02:38:52.903-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "252341",
    "ThreadId": "73357",
    "Html": "This discussion has been copied to a work item. Click <a href=\"http://dotnetzip.codeplex.com/WorkItem/View.aspx?WorkItemId=9097\">here</a> to go to the work item and continue the discussion.",
    "PostedDate": "2009-11-02T02:40:05.573-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "253155",
    "ThreadId": "73357",
    "Html": "<p>I tried testing this, could not reproduce the problem you reported.&nbsp; It should be a very simple test case, I would think.&nbsp; Do you have source code that reliably demonstrates the problem?</p>\r\n<div style=\"color:Black;background-color:White\">\r\n<pre>  <span style=\"color:Blue\">string</span> s1 = <span style=\"color:#A31515\">&quot;&lt;ALL&gt;&lt;/ALL&gt;&quot;</span>;\r\n  <span style=\"color:Blue\">byte</span>[] b = Ionic.Zlib.DeflateStream.CompressString(s1);\r\n  <span style=\"color:Blue\">string</span> s2 = Ionic.Zlib.DeflateStream.UncompressString(b);\r\n  <span style=\"color:Green\">// at this point s1 and s2 are equal.</span>\r\n</pre>\r\n</div>",
    "PostedDate": "2009-11-04T01:34:27.567-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]