Beispiel #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));
        }
Beispiel #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 => new LZ4Decoder(i.BlockSize, ExtraBlocks(i.BlockSize, extraMemory)),
                       leaveOpen));
        }
Beispiel #3
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>
        /// <param name="interactive">If <c>true</c> reading from stream will be "interactive" allowing
        /// to read bytes as soon as possible, even if more data is expected.</param>
        /// <returns>Decompression stream.</returns>
        public static LZ4DecoderStream Decode(
            Stream stream,
            LZ4DecoderSettings settings = null,
            bool leaveOpen   = false,
            bool interactive = false)
        {
            settings ??= LZ4DecoderSettings.Default;
            var extraMemory = settings.ExtraMemory;

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