Пример #1
0
        /// <summary>Creates decompression stream on top of inner stream.</summary>
        /// <param name="stream">Inner stream.</param>
        /// <param name="extraMemory">Extra memory used for decompression.</param>
        /// <param name="leaveOpen">Leave inner stream open after disposing.</param>
        /// <returns>Decompression stream.</returns>
        public static LZ4DecoderStream Decode(
            Stream stream, int extraMemory, bool leaveOpen = false)
        {
            var settings = new LZ4DecoderSettings {
                ExtraMemory = extraMemory
            };

            return(Decode(stream, settings, leaveOpen));
        }
Пример #2
0
        /// <summary>Creates decompression stream on top of inner stream.</summary>
        /// <param name="stream">Inner stream.</param>
        /// <param name="settings">Decompression settings.</param>
        /// <param name="leaveOpen">Leave inner stream open after disposing.</param>
        /// <returns>Decompression stream.</returns>
        public static LZ4DecoderStream Decode(
            Stream stream, LZ4DecoderSettings settings = null, bool leaveOpen = false)
        {
            settings = settings ?? LZ4DecoderSettings.Default;
            var extraMemory = settings.ExtraMemory;

            return(new LZ4DecoderStream(
                       stream,
                       i => LZ4Decoder.Create(
                           i.Chaining, i.BlockSize, ExtraBlocks(i.BlockSize, extraMemory)),
                       leaveOpen));
        }