Bzip2SaveOptions
Inheritance: java.lang.Object
public class Bzip2SaveOptions
Options for saving a bzip2 archive.
Constructors
Constructor | Description |
---|---|
Bzip2SaveOptions(int blockSize) | Initializes a new instance of the Bzip2SaveOptions class. |
Bzip2SaveOptions() | Initializes a new instance of the Bzip2SaveOptions class with default block size, equals to 9 hundred of kilobytes. |
Methods
Method | Description |
---|---|
getBlockSize() | Block size in hundreds of kilobytes. |
getCompressionProgressed() | Gets an event that is raised when a portion of raw stream compressed. |
getCompressionThreads() | Gets compression thread count. |
setCompressionProgressed(Event<ProgressEventArgs> value) | Sets an event that is raised when a portion of raw stream compressed. |
setCompressionThreads(int value) | Sets compression thread count. |
Bzip2SaveOptions(int blockSize)
public Bzip2SaveOptions(int blockSize)
Initializes a new instance of the Bzip2SaveOptions class.
try (FileOutputStream result = new FileOutputStream("archive.bz2")) {
try (Bzip2Archive archive = new Bzip2Archive()) {
archive.setSource("data.bin");
archive.save(result, new Bzip2SaveOptions(9));
}
} catch (IOException ex) {
System.out.println(ex);
}
Parameters:
Parameter | Type | Description |
---|---|---|
blockSize | int | Block size in hundreds of kilobytes. |
Bzip2SaveOptions()
public Bzip2SaveOptions()
Initializes a new instance of the Bzip2SaveOptions class with default block size, equals to 9 hundred of kilobytes.
try (FileOutputStream result = new FileOutputStream("archive.bz2")) {
try (Bzip2Archive archive = new Bzip2Archive()) {
archive.setSource("data.bin");
archive.save(result, new Bzip2SaveOptions());
}
} catch (IOException ex) {
System.out.println(ex);
}
getBlockSize()
public final int getBlockSize()
Block size in hundreds of kilobytes.
Returns: int - block size in hundreds of kilobytes
getCompressionProgressed()
public Event<ProgressEventArgs> getCompressionProgressed()
Gets an event that is raised when a portion of raw stream compressed.
File source = new File("huge.bin");
Bzip2SaveOptions settings = new Bzip2SaveOptions();
settings.setCompressionProgressed((sender, args) -> {
int percent = (int)((100 * args.getProceededBytes()) / source.length());
});
This event won’t be raised when compressing in multithreaded mode.
Returns: Event - an event that is raised when a portion of raw stream compressed
getCompressionThreads()
public final int getCompressionThreads()
Gets compression thread count. If the value greater than 1, multithreading compression will be used.
Returns: int - Compression thread count.
setCompressionProgressed(Event<ProgressEventArgs> value)
public void setCompressionProgressed(Event<ProgressEventArgs> value)
Sets an event that is raised when a portion of raw stream compressed.
File source = new File("huge.bin");
Bzip2SaveOptions settings = new Bzip2SaveOptions();
settings.setCompressionProgressed((sender, args) -> {
int percent = (int)((100 * args.getProceededBytes()) / source.length());
});
This event won’t be raised when compressing in multithreaded mode.
Parameters:
Parameter | Type | Description |
---|---|---|
value | com.aspose.zip.Event<com.aspose.zip.ProgressEventArgs> | an event that is raised when a portion of raw stream compressed |
setCompressionThreads(int value)
public final void setCompressionThreads(int value)
Sets compression thread count. If the value greater than 1, multithreading compression will be used.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int | Compression thread count. |