System.StreamExtensions.WrapGZip C# (CSharp) Méthode

WrapGZip() public static méthode

Wraps stream into GZip compression stream resulting in writing compressed stream
public static WrapGZip ( this stream, bool buffered = true ) : Stream
stream this
buffered bool
Résultat Stream
        public static Stream WrapGZip(this Stream stream, bool buffered = true)
        {
            // BufferedStream is necessary, because we don't want to compress byte-by-byte
            var gz = new GZipStream(stream, CompressionMode.Compress, false);
            return buffered ? new BufferedStream(gz, 32 * 1024) : (Stream)gz; // BufferedStream closes inner stream when closed, this is safe
        }