Esempio n. 1
0
        /// <summary>Initialize the inflation state with an explicit flag to govern the handling of RFC1950 header bytes.</summary>
        /// <remarks>If you want to read a zlib stream you should specify true for expectRfc1950Header. In this case, the library will expect to find a ZLIB header, as defined in <see href = "http://www.ietf.org/rfc/rfc1950.txt">RFC 1950</see>, in the compressed stream.  If you will be reading a DEFLATE or GZIP stream, which does not have such a header, you will want to specify false.</remarks>
        /// <param name="windowBits">The number of window bits to use. If you need to ask what that is, then you shouldn't be calling this initializer.</param>
        /// <param name="expectRfc1950Header">whether to expect an RFC1950 header byte pair when reading the stream of data to be inflated.</param>
        /// <returns>Z_OK if everything goes well.</returns>
        internal int InitializeInflate(int windowBits, bool expectRfc1950Header)
        {
            this.WindowBits = windowBits;
            if (this.Dstate != null)
            {
                throw new ZlibException("You may not call InitializeInflate() after calling InitializeDeflate().");
            }

            this.Istate = new InflateManager(expectRfc1950Header);
            return(this.Istate.Initialize(this, windowBits));
        }
Esempio n. 2
0
        /// <summary>
        /// Ends an inflation session.
        /// </summary>
        /// <remarks>
        /// Call this after successively calling Inflate().  This will cause all buffers to be flushed.
        /// After calling this you cannot call Inflate() without a intervening call to one of the
        /// InitializeInflate() overloads.
        /// </remarks>
        /// <returns>Z_OK if everything goes well.</returns>
        public int EndInflate()
        {
            if (istate == null)
            {
                throw new ZlibException("No Inflate State!");
            }
            int ret = istate.End();

            istate = null;
            return(ret);
        }
Esempio n. 3
0
        /// <summary>Ends an inflation session.</summary>
        /// <remarks>Call this after successively calling Inflate().  This will cause all buffers to be flushed.  After calling this you cannot call Inflate() without a intervening call to one of the InitializeInflate() overloads.</remarks>
        /// <returns>Z_OK if everything goes well.</returns>
        internal int EndInflate()
        {
            if (this.Istate == null)
            {
                throw new ZlibException("No Inflate State!");
            }

            int ret = this.Istate.End();

            this.Istate = null;
            return(ret);
        }
Esempio n. 4
0
        /// <summary>Initialize the inflation state with an explicit flag to govern the handling of RFC1950 header bytes.</summary>
        /// <remarks>If you want to read a zlib stream you should specify true for expectRfc1950Header. In this case, the library will expect to find a ZLIB header, as defined in <see href = "http://www.ietf.org/rfc/rfc1950.txt">RFC 1950</see>, in the compressed stream.  If you will be reading a DEFLATE or GZIP stream, which does not have such a header, you will want to specify false.</remarks>
        /// <param name="windowBits">The number of window bits to use. If you need to ask what that is, then you shouldn't be calling this initializer.</param>
        /// <param name="expectRfc1950Header">whether to expect an RFC1950 header byte pair when reading the stream of data to be inflated.</param>
        /// <returns>Z_OK if everything goes well.</returns>
        internal int InitializeInflate(int windowBits, bool expectRfc1950Header)
        {
            this.WindowBits = windowBits;
            if (this.Dstate != null)
            {
                throw new ZlibException("You may not call InitializeInflate() after calling InitializeDeflate().");
            }

            this.Istate = new InflateManager(expectRfc1950Header);
            return this.Istate.Initialize(this, windowBits);
        }
Esempio n. 5
0
        /// <summary>Ends an inflation session.</summary>
        /// <remarks>Call this after successively calling Inflate().  This will cause all buffers to be flushed.  After calling this you cannot call Inflate() without a intervening call to one of the InitializeInflate() overloads.</remarks>
        /// <returns>Z_OK if everything goes well.</returns>
        internal int EndInflate()
        {
            if (this.Istate == null)
            {
                throw new ZlibException("No Inflate State!");
            }

            int ret = this.Istate.End();
            this.Istate = null;
            return ret;
        }