Bzip2 Class

Properties   Methods   Events   Configuration Settings   Errors  

The Bzip2 class implements a bzip2 compressor and decompressor. It is compliant with bzip2 specification.

Class Name

IPWorksZip_Bzip2

Procedural Interface

 ipworkszip_bzip2_open();
 ipworkszip_bzip2_close($res);
 ipworkszip_bzip2_register_callback($res, $id, $function);
 ipworkszip_bzip2_get_last_error($res);
 ipworkszip_bzip2_get_last_error_code($res);
 ipworkszip_bzip2_set($res, $id, $index, $value);
 ipworkszip_bzip2_get($res, $id, $index);
 ipworkszip_bzip2_do_abort($res);
 ipworkszip_bzip2_do_append($res);
 ipworkszip_bzip2_do_compress($res);
 ipworkszip_bzip2_do_config($res, $configurationstring);
 ipworkszip_bzip2_do_extract($res);
 ipworkszip_bzip2_do_extractall($res);
 ipworkszip_bzip2_do_reset($res);
 ipworkszip_bzip2_do_scan($res);

Remarks

The bzip2 file format is typically used only to archive a single file. Accordingly, the operation of the class is simpler than that of the other classs.

To compress with the class, set ArchiveFile to the name of the bzip2 file to be created, and FileDecompressedName to the name of the file to be compressed. Finally, invoke Compress. To extract the file, set ArchiveFile to the bzip2 archive and FileDecompressedName to the file where the class should extract. Finally, invoke the Extract or Compress method.

Example (Creating a Bzip2 File)


ZipControl.ArchiveFile = "c:\test.bz2"
ZipControl.FileDecompressedName = "c:\test.txt"
ZipControl.Compress()
Example (Extracting from a Bzip2 File)


ZipControl.ArchiveFile = "c:\test.bz2"
ZipControl.FileDecompressedName = "c:\test.txt"
ZipControl.Extract()

This class is an implementation based on Julian Seward's bzip2 library (http://www.bzip.org).

Property List


The following is the full list of the properties of the class with short descriptions. Click on the links for further details.

ArchiveFileThe name of the zip, gzip, tar, or jar archive.
Bzip2Data(Decompression only) The bzip2 file contents as a byte array.
ExtractToPathA base path to decompress to.
FileDecompressedNameFile name to decompress to, or compress from.
FileInputDataThe data of the file to be compressed.
HasMoreDataShows whether or not there is more data in the bzip2 archive.

Method List


The following is the full list of the methods of the class with short descriptions. Click on the links for further details.

AbortAborts the current operation.
AppendAdds specified file to an existing archive.
CompressCreates the compressed bzip2 archive.
ConfigSets or retrieves a configuration setting.
ExtractExtracts the compressed file from the bzip2 archive.
ExtractAllExtracts all files from the compressed archive.
ResetResets the class.
ScanScans the compressed archive.

Event List


The following is the full list of the events fired by the class with short descriptions. Click on the links for further details.

BeginFileFired before a file is processed.
EndFileFired after a file is processed.
ErrorInformation about non-fatal errors.
OverwriteFired whenever a file exists and may be overwritten.
ProgressFired as progress is made.

Configuration Settings


The following is a list of configuration settings for the class with short descriptions. Click on the links for further details.

WriteToProgressEventWhether or not to write data to the Progress Event.
BuildInfoInformation about the product's build.
CodePageThe system code page used for Unicode to Multibyte translations.
LicenseInfoInformation about the current license.
ProcessIdleEventsWhether the class uses its internal event loop to process events when the main thread is idle.
SelectWaitMillisThe length of time in milliseconds the class will wait when DoEvents is called if there are no events to process.
UseInternalSecurityAPITells the class whether or not to use the system security libraries or an internal implementation.

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks ZIP 2020 PHP Edition - Version 20.0 [Build 8300]