5.32 ZipService
The ZipService provides support for:
- Creating zip file archives
- Adding files and directories to zip file archives
- Extracting files and directories from zip file archives
Archives are files that contain other files, typically in a compressed format. Zip files are the most common archive format and provide compression and file grouping.
The Zip format is widely used and supported. Most computer users will be able to create or process zip file archives. The ZipService provides an easy method for your applications to create and process these files.
Related Services
The ZipService is not dependent on other services. It can be used on its own to create, add to or extract from zip file archives. However, depending on the requirements of your application, you may wish, for example, to use one or more of the transport services to send or receive zip file archives via FTP, HTTP or email.
Note that the SMTPMailService has a feature that can collect a group of attachments into a single zip archive to attach to an out-going email message. For out-going mail applications, this feature could make it unnecessary to explicitly invoke the ZipService.
Technical Specifications
- The ZipService makes use of standard Java classes to implement its zip functionality.
- The degree of compression achieved for individual files will vary significantly depending on the nature of the file content. Binary files such as program executable files will yield relatively little compression, while text files will often achieve high compression. Some files, particularly those file formats that are already compressed (such as JPEG image files) may not compress at all or may even yield a larger file than the original following compression.