Class Bzip2SaveOptions
Namespace: Aspose.Zip.Bzip2
Assembly: Aspose.Zip.dll (25.1.0)
Tùy chọn để lưu trữ một tập tin bzip2.
public class Bzip2SaveOptions
Kế thừa
Các thành viên kế thừa
object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Các hàm khởi tạo
Bzip2SaveOptions(int)
Khởi tạo một thể hiện mới của lớp Aspose.Zip.Bzip2.Bzip2SaveOptions.
public Bzip2SaveOptions(int blockSize)
Tham số
blockSize
int
Kích thước khối tính bằng hàng trăm kilobyte.
Ví dụ
using (FileStream result = File.Open("archive.bz2"))
{
using (Bzip2Archive archive = new Bzip2Archive())
{
archive.SetSource("data.bin");
archive.Save(result, new Bzip2SaveOptions(9));
}
}
Ngoại lệ
Kích thước khối không nằm trong khoảng hợp lệ.
Bzip2SaveOptions()
Khởi tạo một thể hiện mới của lớp Aspose.Zip.Bzip2.Bzip2SaveOptions với kích thước khối mặc định, bằng 9 trăm kilobyte.
public Bzip2SaveOptions()
Ví dụ
using (FileStream result = File.Open("archive.bz2"))
{
using (Bzip2Archive archive = new Bzip2Archive())
{
archive.SetSource("data.bin");
archive.Save(result, new Bzip2SaveOptions());
}
}
Thuộc tính
BlockSize
Kích thước khối tính bằng hàng trăm kilobyte.
public int BlockSize { get; }
Giá trị thuộc tính
CompressionThreads
Lấy hoặc thiết lập số lượng luồng nén. Nếu giá trị lớn hơn 1, sẽ sử dụng nén đa luồng.
public int CompressionThreads { get; set; }
Giá trị thuộc tính
Ngoại lệ
Số lượng luồng lớn hơn 100 hoặc nhỏ hơn 1.
CompressionProgressed
Được kích hoạt khi một phần của luồng thô đã được nén.
public event EventHandler<progresseventargs> CompressionProgressed
Loại sự kiện
EventHandler<ProgressEventArgs>
Ví dụ
settings.CompressionProgressed += (s, e) => { int percent = (int)((100 * e.ProceededBytes) / entrySourceStream.Length); };
Ghi chú
Sự kiện này sẽ không được kích hoạt khi nén ở chế độ đa luồng.