BZip2InputStream Constructor (input, leaveOpen)

DotNetZip

Ionic Zip Library v1.9.1.6 BZip2InputStream Constructor (input, leaveOpen)
ReferenceIonic.BZip2BZip2InputStreamBZip2InputStream(Stream, Boolean)
Create a BZip2InputStream with the given stream, and specifying whether to leave the wrapped stream open when the BZip2InputStream is closed.
Declaration Syntax
C# Visual Basic Visual C++
public BZip2InputStream(
	Stream input,
	bool leaveOpen
)
Public Sub New ( _
	input As Stream, _
	leaveOpen As Boolean _
)
public:
BZip2InputStream(
	Stream^ input, 
	bool leaveOpen
)
Parameters
input (Stream)
The stream from which to read compressed data
leaveOpen (Boolean)
Whether to leave the input stream open, when the BZip2InputStream closes.
Examples
This example reads a bzip2-compressed file, decompresses it, and writes the decompressed data into a newly created file.
CopyC#
var fname = "logfile.log.bz2";
using (var fs = File.OpenRead(fname))
{
    using (var decompressor = new Ionic.BZip2.BZip2InputStream(fs))
    {
        var outFname = fname + ".decompressed";
        using (var output = File.Create(outFname))
        {
            byte[] buffer = new byte[2048];
            int n;
            while ((n = decompressor.Read(buffer, 0, buffer.Length)) > 0)
            {
                output.Write(buffer, 0, n);
            }
        }
    }
}

Assembly: Ionic.Zip (Module: Ionic.Zip) Version: 1.9.1.8 (1.9.1.8)