Ionic Zip Library v1.9.1.6
BZip2InputStream Constructor (input, leaveOpen)
Reference ► Ionic.BZip2 ► BZip2InputStream ► BZip2InputStream(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
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); } } } }