Jar Component

Properties   Methods   Events   Configuration Settings   Errors  

The Jar component may be used to create or decompress Java archives.




The operation of the component is similar to that of Zip. .class and other files may be added into a .jar file, and then may be imported into Java code or executed by a JVM.

To create a new archive, first set the ArchiveFile property to the name of the archive to be created. Then, specify the files to be compressed either by invoking IncludeFiles, or by adding a new object to the Files collection and setting the values of the DecompressedName and CompressedName. fields. Finally, call the Compress method to create the archive.

To decompress an existing archive, set ArchiveFile to the name of the archive to be decompressed. The ExtractToPath property may be set, and then calling the ExtractAll method will decompress all files in the archive to this path.

For finer control, the Scan method should be used to read the file information stored in the archive. This will fill out the information in the Files collection. The values of DecompressedName may then be changed if desired. Finally, ExtractAll may be used to decompress the entire archive, or Extract may be used for finer control.

Data may be streamed out by setting WriteToProgressEvent to true. Then, the Progress event may be trapped to retrieve the data.

All Java archives contain two special entries, a META-INF directory and a manifest. By default, the component will automatically generate a default manifest and add the special entries to the beginning of the archive. To instead add a custom manifest to the archive the ManifestFile property should be set.

During decompression, the archive is treated as an ordinary zip file.

Example (Creating a Jar File)

ZipControl.ArchiveFile = "c:\test.jar"
ZipControl.RecurseSubdirectories = false
ZipControl.ManifestFile = "c:\code\manifest.mf"
Example (Extracting from a Jar File)

ZipControl.ArchiveFile = "c:\test.jar"
ZipControl.ExtractToPath = "c:\extracted\"

Property List

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

ArchiveFileThe name of the zip, gzip, tar, or jar archive.
CompressionLevelThe compression level to use.
ExcludedFilesA list of files to exclude.
ExtractToPathA base path to decompress to.
FilesCollection of Jar archive files.
JarData(Decompression only) The jar file contents as a byte array.
ManifestFileThe name of the manifest file.
OverwriteFilesWhether or not to overwrite files.
RecurseSubdirectoriesWhether or not to recurse into subdirectories.

Method List

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

AbortAborts the current operation.
AppendFilesAdds specified files to an existing archive.
CompressCreates the compressed archive.
ConfigSets or retrieves a configuration setting.
DeleteDeletes one or more files from an existing archive.
ExtractExtracts a single file, directory, or group of files, from the archive.
ExtractAllExtracts all files from the compressed archive.
IncludeFilesSpecifies that the indicated files should be added to the archive.
ResetResets the component.
ScanScans the compressed archive.
SetArchiveInputStreamThe stream to read the zip, tar, jar, or gzip archive from.
SetArchiveOutputStreamThe stream to write the zip, tar, jar, or gzip archive to.

Event List

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

BeginFileFired before each file is processed.
EndFileFired after each 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 component with short descriptions. Click on the links for further details.

CheckForFileLocksIf true, the component requests an exclusive lock during initialization.
CloseStreamAfterCompressIf true, the component will close the output stream after compression.
EncodingEncoding to be used for filenames.
ExcludedAttributesAttributes of files to be excluded.
ExtractFilesOnlyWhether to only extract the files contained within the archive.
OverwriteReadonlyFilesWhether to overwrite readonly files.
WriteToProgressEventWhether or not to write data to the Progress Event.
BuildInfoInformation about the product's build.
GUIAvailableTells the component whether or not a message loop is available for processing events.
LicenseInfoInformation about the current license.
UseInternalSecurityAPITells the component 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 .NET Edition - Version 20.0 [Build 8172]