[
  {
    "Id": "225435",
    "ThreadId": "66363",
    "Html": "<p>I'm trying to read from a compression stream, but I'm getting an exception:</p>\r\n<p>Ionic.Zlib.ZlibException : AvailableBytesOut == 0 &amp;&amp; flush&lt;=old_flush &amp;&amp; flush != FlushType.Finish</p>\r\n<p>This is the example (sorry for the strange language, but &nbsp;I think its readable):</p>\r\n<p>LOCAL s := <span style=\"color:#A31515\">&quot;This is a test file&quot;</span> AS STRING <br>MemoWrit(<span style=\"color:#A31515\">&quot;test2.txt&quot;</span>,s) //write test file<br>LOCAL oInStream := System.IO.FileStream{<span style=\"color:#A31515\">&quot;test2.txt&quot;</span>, System.IO.FileMode.Open} AS System.IO.FileStream <br>LOCAL oFileStream := System.IO.FileStream{<span style=\"color:#A31515\">&quot;test2.zlib&quot;</span>,System.IO.FileMode.Create} AS System.IO.FileStream <br>LOCAL oZStream := Ionic.Zlib.ZlibStream{oInStream, Ionic.Zlib.CompressionMode.Compress} AS Ionic.Zlib.ZlibStream <br>LOCAL len <span style=\"color:Blue\">as</span> INT <br>LOCAL buffer := <span style=\"color:Blue\">byte</span>[]{2000} AS <span style=\"color:Blue\">byte</span>[]           <br>&nbsp;<br>WHILE (len := oZStream:Read(buffer,0,2000)) &gt; 0 // <br>&nbsp; &nbsp; oFileStream:Write(buffer,0,len) <br>END <br>oZStream:Close()</p>\r\n<p>It fails in the second iteration of the loop when there is no more data to read. I thought that Read sould return 0 when there was no more data to read. Is there any way to find out that there is no more data to read? Using FlushMode Finish makes it work but that would certainly have penalties&nbsp;for large files? I can't find any example of reading from an compression stream. Since my task is not to write it back to a file (this was just for testing), writing to a compression stream is not an option.</p>\r\n<p>Regards,</p>\r\n<p>Haakon</p>",
    "PostedDate": "2009-08-19T07:32:29.8-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "225526",
    "ThreadId": "66363",
    "Html": "<p>Haakon,</p>\r\n<p>yes I get the same problem here. Something is wrong when using ZlibStream in compression, while reading.&nbsp; This is supposed to work.</p>\r\n<p>If you want to compress, you could do it through writing.&nbsp; In other words, something like this?</p>\r\n<pre>  LOCAL oInStream := System.IO.FileStream{&quot;test2.txt&quot;, System.IO.FileMode.Open} AS System.IO.FileStream\r\n  LOCAL oFileStream := System.IO.FileStream{&quot;test2.zlib&quot;,System.IO.FileMode.Create} AS System.IO.FileStream\r\n  LOCAL oZStream := Ionic.Zlib.ZlibStream{oFileStream, Ionic.Zlib.CompressionMode.Compress} AS Ionic.Zlib.ZlibStream\r\n\r\n  WHILE (len := oInStream:Read(buffer,0,2000)) &gt; 0 //\r\n    oZStream:Write(buffer,0,len)             \r\n  END \r\n  oZStream:Close()\r\n        </pre>\r\n<p>In the meantime I will set about fixing the problem in the library.</p>",
    "PostedDate": "2009-08-19T10:30:33.947-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "225528",
    "ThreadId": "66363",
    "Html": "This discussion has been copied to a work item. Click <a href=\"http://dotnetzip.codeplex.com/WorkItem/View.aspx?WorkItemId=8557\">here</a> to go to the work item and continue the discussion.",
    "PostedDate": "2009-08-19T10:36:18.307-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "225679",
    "ThreadId": "66363",
    "Html": "<p>ok, it's fixed in v1.8.4.20.</p>",
    "PostedDate": "2009-08-19T18:54:18.68-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]