Zipping and Unzipping Files in JavaZIP is a common file format that compresses one or more files into a single location. It reduces the file size and makes it easier to transport or store. A recipient can unzip (or extract) a ZIP file after transport and use the file in the original format. 1. Single Zip fileLet's see how we can zip one file in Java using the core Java libraries java.util.zip package. ZipMultipleFiles.java Output: When we open the created zip file, we found the text file. 2. Multiple Zip FilesLet's see how we can zip multiple files in Java using the core java libraries java.util.zip package. ZipMultipleFiles.java Output: Let's open the zip file. 3. Zip DirectoryLet's see how we can zip a directory in Java using the core libraries of java.util.zip package. ZipDirectory.java Output: zipFiles contains following files: 4. Unzip a fileLet's see how we can unzip a file in Java using the core libraries of java.util.zip package. Unzip.java Output: Let's open the web folder. |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India