Zip¶
-
public final class
Zip
¶ Zip is a tool which can compress a set of files contained in a directory into a zip file. Likewise, it can also extract a set of files compressed in a zip file to a directory.
Author: Hugo Y. K. Lam
Methods¶
compress¶
-
public static void
compress
(File toFile, File dir)¶ Compresses a set of files contained in a directory into a zip file.
Parameters: - toFile – the zip file.
- dir – the directory which contains the files to be compressed.
Throws: - UtilitiesException – if there is any error in the compression.
extract¶
-
public static void
extract
(File fromFile, File dir)¶ Extracts a set of files compressed in a zip file to a directory.
Parameters: - fromFile – the zip file.
- dir – the directory to which the files to be extracted. Current user directory will be chosen if it is null.
Throws: - UtilitiesException – if there is any error in the extraction.