コード例 #1
0
        /// <summary>
        /// Finishes the stream by calling finish() on the deflater.
        /// </summary>
        /// <exception cref="SharpZipBaseException">
        /// Not all input is deflated
        /// </exception>
        public virtual void Finish()
        {
            Deflater.Finish();
            while (!Deflater.IsFinished)
            {
                int len = Deflater.Deflate(_buffer, 0, _buffer.Length);
                if (len <= 0)
                {
                    break;
                }

                BaseOutputStream.Write(_buffer, 0, len);
            }

            if (!Deflater.IsFinished)
            {
                throw new SharpZipBaseException("Can't deflate all input?");
            }

            BaseOutputStream.Flush();
        }
コード例 #2
0
 /// <summary>
 /// Flushes the stream by calling <see cref="Flush">Flush</see> on the deflater and then
 /// on the underlying stream.  This ensures that all bytes are flushed.
 /// </summary>
 public override void Flush()
 {
     Deflater.Flush();
     Deflate();
     BaseOutputStream.Flush();
 }