Example #1
0
        public void Recycle()
        {
            deflateStream.Recycle();

            if (mode == CompressionMode.Compress)
            {
                IFileFormatWriter writeCommand = new GZipFormatter();
                deflateStream.SetFileFormatWriter(writeCommand);
            }
            else
            {
                IFileFormatReader readCommand = new GZipDecoder();
                deflateStream.SetFileFormatReader(readCommand);
            }
        }
Example #2
0
        public GZipStream(Stream stream, CompressionMode mode, bool leaveOpen)
        {
            this.mode = mode;

            deflateStream = new DeflateStream(stream, mode, leaveOpen);

            if (mode == CompressionMode.Compress)
            {
                IFileFormatWriter writeCommand = new GZipFormatter();
                deflateStream.SetFileFormatWriter(writeCommand);
            }
            else
            {
                IFileFormatReader readCommand = new GZipDecoder();
                deflateStream.SetFileFormatReader(readCommand);
            }
        }