In this example we will discuss about how to create zip file from the text file. In the following code ZipOutputStream class from java.util.zip package is used. The ZipOutputStream class provides the methods to create zip file.
import java.io.*; |
When you compile and run this program it will create the zip (zipfile.zip ) of unzipfile.txt file