Ionic Zip Library v1.9.1.6
ParallelBZip2OutputStream Constructor (output)
Reference ► Ionic.BZip2 ► ParallelBZip2OutputStream ► ParallelBZip2OutputStream(Stream)
Constructs a new ParallelBZip2OutputStream, that sends its
compressed output to the given output stream.
Declaration Syntax
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.ParallelBZip2OutputStream(output)) { byte[] buffer = new byte[2048]; int n; while ((n = fs.Read(buffer, 0, buffer.Length)) > 0) { compressor.Write(buffer, 0, n); } } } }