In this section, you will wll learn How to unzip (extract) a zip file? How to retrieve elements from a zip format file?
Unzip a ZIP File
How to unzip (extract) a zip file? How to retrieve
elements from a zip format file? All these type of questions are solved through
the following example. This program shows you how to extract files from a zip
file in which many different files are stored in compressed format and make a
single zip file.
There are various type methods and APIs are explained
as follows which are used in the following program to retrieve all the
compressed elements from the zip file.
ZipEntry: This is the class of java.util.zip.*; package of Java which is used
to zip file entries.
ZipFile.entries(): Above method of the ZipFile class gets the files entries of the zip
Enumeration.hasMoreElement(): This method checks whether more element elements are present or not for the
zip file which are enumerated.
Enumeration.nextElement(): This method gives you the next elements from the list of the files, which
are compressed and stored in the zip file.
January 28, 2012
can u guide me to execute the aboue code...
i used to retrive the zipped content by using this code but this code doesnot recognizes the .ZIP conetnt even thoug i entered the correct file
so please give me the process to execute the above code
October 4, 2012
how to unzip file to a zip file.please help me.
December 12, 2012
the code is running fine. but the output it gives is a file type element not a file folder type.that means i cant open the output file given by this code. plz help.