BZip2OutputStream Constructor (output)

DotNetZip

Ionic Zip Library v1.9.1.6 BZip2OutputStream Constructor (output)
ReferenceIonic.BZip2BZip2OutputStreamBZip2OutputStream(Stream)
Constructs a new BZip2OutputStream, that sends its compressed output to the given output stream.
Declaration Syntax
C# Visual Basic Visual C++
public BZip2OutputStream(
	Stream output
)
Public Sub New ( _
	output As Stream _
)
public:
BZip2OutputStream(
	Stream^ output
)
Parameters
output (Stream)
The destination stream, to which compressed output will be sent.
Examples
This example reads a file, then compresses it with bzip2 file, and writes the compressed data into a newly created file.
CopyC#
var fname = "logfile.log";
using (var fs = File.OpenRead(fname))
{
    var outFname = fname + ".bz2";
    using (var output = File.Create(outFname))
    {
        using (var compressor = new Ionic.BZip2.BZip2OutputStream(output))
        {
            byte[] buffer = new byte[2048];
            int n;
            while ((n = fs.Read(buffer, 0, buffer.Length)) > 0)
            {
                compressor.Write(buffer, 0, n);
            }
        }
    }
}

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