title: Port DeflaterInputStream functionality to .net
body: <p>I am trying to port the following java code to .net:</p>
  
  <pre><code>private final byte[] zipLicense(byte lic[])
  {
      byte buf[];
      ByteArrayInputStream bis;
      DeflaterInputStream dis;
      ByteArrayOutputStream bos;
      buf = new byte[64];
      bis = new ByteArrayInputStream(lic);
      dis = new DeflaterInputStream(bis, new Deflater());
      bos = new ByteArrayOutputStream();
      byte abyte0[];
      int len;
      while((len = dis.read(buf)) &gt; 0) 
          bos.write(buf, 0, len);
      abyte0 = bos.toByteArray();
      try
      {
          bis.close();
          dis.close();
          bos.close();
      }
      catch(IOException ex)
      {
          ex.printStackTrace();
      }
      return abyte0;
  }
  </code></pre>
  
  <p>My best shot was this code in C#:</p>
  
  <pre><code>private byte[] zipLicense(byte[] lic)
  {
      var outputMemStream = new MemoryStream();
  
      ZipOutputStream zipStream;
  
      using (zipStream = new ZipOutputStream(outputMemStream))
      {
          zipStream.Write(lic, 0, lic.Length);
          Debug.WriteLine(string.Format("Compressed bytes: {0}", outputMemStream.Length));
      }
  
      return outputMemStream.ToArray();
  }
  </code></pre>
  
  <p>ZipOutputStream is a class from <a href="https://github.com/icsharpcode/SharpZipLib" rel="nofollow">SharpZipLib</a></p>
  
  <p>When I try to run the C# code, I get error on first attempt to write to zipStream </p>
  
  <pre><code>zipStream.Write(lic, 0, lic.Length);
  </code></pre>
  
  <p>The error states that I haven't provided "No entry". I see in examples that one can and probably should seciffy an entry string to a zip stream, but what java code puts as an entry then? Please help in porting this java functionality to .Net. Thanks!</p>