Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ZlibStream"/> class by using the specified stream and compression level, and optionally leaves the stream open.
        /// </summary>
        /// <param name="stream">The stream to compress or decompress.</param>
        /// <param name="compressionLevel">One of the enumeration values that indicates whether to emphasize speed or compression efficiency when compressing the stream.</param>
        /// <param name="leaveOpen">true to leave the stream open after disposing the <see cref="ZlibStream"/> object; otherwise, false.</param>
        public ZlibStream(Stream stream, CompressionLevel compressionLevel, bool leaveOpen)
        {
#if !PORTABLE
            _stream = stream;
            _leaveOpen = leaveOpen;

            _deflateStream = new DeflateStream(stream, compressionLevel.ToCompressionLevel(), true);

            WriteHeader();
#endif
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ZlibStream"/> class by using the specified stream and compression level, and optionally leaves the stream open.
        /// </summary>
        /// <param name="stream">The stream to compress or decompress.</param>
        /// <param name="compressionLevel">One of the enumeration values that indicates whether to emphasize speed or compression efficiency when compressing the stream.</param>
        /// <param name="leaveOpen">true to leave the stream open after disposing the <see cref="ZlibStream"/> object; otherwise, false.</param>
        public ZlibStream(Stream stream, CompressionLevel compressionLevel, bool leaveOpen)
        {
#if !PORTABLE
            _stream    = stream;
            _leaveOpen = leaveOpen;

            _deflateStream = new DeflateStream(stream, compressionLevel.ToCompressionLevel(), true);

            WriteHeader();
#endif
        }
Exemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ZlibStream"/> class by using the specified stream and compression level, and optionally leaves the stream open.
        /// </summary>
        /// <param name="stream">The stream to compress or decompress.</param>
        /// <param name="compressionLevel">One of the enumeration values that indicates whether to emphasize speed or compression efficiency when compressing the stream.</param>
        /// <param name="leaveOpen">true to leave the stream open after disposing the <see cref="ZlibStream"/> object; otherwise, false.</param>
        public ZlibStream(Stream stream, CompressionLevel compressionLevel, bool leaveOpen)
        {
#if PORTABLE
            ExceptionHelper.ThrowNotSupported();
#else
            _stream    = stream;
            _leaveOpen = leaveOpen;

            _deflateStream = new DeflateStream(stream, compressionLevel.ToCompressionLevel(), true);

            WriteHeader();
#endif
        }