/// <summary>
 /// End a deflation session.
 /// </summary>
 /// <remarks>
 /// Call this after making a series of one or more calls to Deflate(). All buffers are flushed.
 /// </remarks>
 /// <returns>Z_OK if all goes well.</returns>
 public int EndDeflate()
 {
     if (dstate == null)
         throw new ZlibException("No Deflate State!");
     // TODO: dinoch Tue, 03 Nov 2009  15:39 (test this)
     //int ret = dstate.End();
     dstate = null;
     return ZlibConstants.Z_OK; //ret;
 }
        private int _InternalInitializeDeflate(bool wantRfc1950Header)
        {
            if (istate != null) throw new ZlibException("You may not call InitializeDeflate() after calling InitializeInflate().");
            dstate = new DeflateManager();
            dstate.WantRfc1950HeaderBytes = wantRfc1950Header;

            return dstate.Initialize(this, this.CompressLevel, this.WindowBits, this.Strategy);
        }