/// <summary>
        /// Creates a new DeflaterOutputStream with the given Deflater and
        /// buffer size.
        /// </summary>
        /// <param name="baseOutputStream">
        /// The output stream where deflated output is written.
        /// </param>
        /// <param name="deflater">
        /// The underlying deflater to use
        /// </param>
        /// <param name="bufsize">
        /// The buffer size to use when deflating
        /// </param>
        /// <exception cref="ArgumentOutOfRangeException">
        /// bufsize is less than or equal to zero.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// baseOutputStream does not support writing
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// deflater instance is null
        /// </exception>
        public DeflaterOutputStream(Stream baseOutputStream, Deflater deflater, int bufsize)
        {
            if (baseOutputStream.CanWrite == false) {
                throw new ArgumentException("baseOutputStream", "must support writing");
            }

            if (deflater == null) {
                throw new ArgumentNullException("deflater");
            }

            if (bufsize <= 0) {
                throw new ArgumentOutOfRangeException("bufsize");
            }

            this.baseOutputStream = baseOutputStream;
            buf = new byte[bufsize];
            def = deflater;
        }
 /// <summary>
 /// Creates a new DeflaterOutputStream with the given Deflater and
 /// default buffer size.
 /// </summary>
 /// <param name="baseOutputStream">
 /// the output stream where deflated output should be written.
 /// </param>
 /// <param name="defl">
 /// the underlying deflater.
 /// </param>
 public DeflaterOutputStream(Stream baseOutputStream, Deflater defl)
     : this(baseOutputStream, defl, 512)
 {
 }