예제 #1
0
        /// <summary>
        /// Creates a decompression stream on top of the <see cref="Stream"/> specified.
        /// </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>
        /// The decompression stream.
        /// </returns>
        public static LZ4DecoderStream Decode(Stream stream, int extraMemory, bool leaveOpen = false)
        {
            LZ4DecoderSettings settings = new LZ4DecoderSettings {
                ExtraMemory = extraMemory
            };

            return(Decode(stream, settings, leaveOpen));
        }
예제 #2
0
        /// <summary>
        /// Creates a decompression stream on top of the <see cref="Stream"/> specified.
        /// </summary>
        /// <param name="stream">Inner stream.</param>
        /// <param name="settings">Decompression settings.</param>
        /// <param name="leaveOpen">Leave inner stream open after disposing.</param>
        /// <returns>
        /// The decompression stream.
        /// </returns>
        public static LZ4DecoderStream Decode(Stream stream, LZ4DecoderSettings settings = null, bool leaveOpen = false)
        {
            settings = settings ?? LZ4DecoderSettings.Default;
            int extraMemory = settings.ExtraMemory;

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