Class Bzip2SaveOptions
Namespace: Aspose.Zip.Bzip2
Assembly: Aspose.Zip.dll (25.2.0)
Options for saving a bzip2 archive.
public class Bzip2SaveOptions
Inheritance
Inherited Members
object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Constructors
Bzip2SaveOptions(int)
Initializes a new instance of the Aspose.Zip.Bzip2.Bzip2SaveOptions class.
public Bzip2SaveOptions(int blockSize)
Parameters
blockSize
int
Block size in hundreds of kilobytes.
Examples
using (FileStream result = File.Open("archive.bz2"))
{
using (Bzip2Archive archive = new Bzip2Archive())
{
archive.SetSource("data.bin");
archive.Save(result, new Bzip2SaveOptions(9));
}
}
Exceptions
Block size is not in valid range.
Bzip2SaveOptions()
Initializes a new instance of the Aspose.Zip.Bzip2.Bzip2SaveOptions class with default block size, equals to 9 hundred of kilobytes.
public Bzip2SaveOptions()
Examples
using (FileStream result = File.Open("archive.bz2"))
{
using (Bzip2Archive archive = new Bzip2Archive())
{
archive.SetSource("data.bin");
archive.Save(result, new Bzip2SaveOptions());
}
}
Properties
BlockSize
Block size in hundreds of kilobytes.
public int BlockSize { get; }
Property Value
CompressionThreads
Gets or sets compression thread count. If the value greater than 1, multithreading compression will be used.
public int CompressionThreads { get; set; }
Property Value
Exceptions
The number of threads is more than 100 or less than 1.
CompressionProgressed
Raises when a portion of raw stream compressed.
public event EventHandler<progresseventargs> CompressionProgressed
Event Type
EventHandler<ProgressEventArgs>
Examples
settings.CompressionProgressed += (s, e) => { int percent = (int)((100 * e.ProceededBytes) / entrySourceStream.Length); };
Remarks
This event won’t be raised when compressing in multithreaded mode.