In this Example, We will discuss the use getMethod, getSize and
getTime method of ZipEntry class.
The ZipEntry class is used to show the single entry in ZIP file. The ZipEntery class provides methods for
retrieving information related to entry. The ZipEntry class is available in java.util.zip package.
The getMethod method of ZipEntry class returns compression method of entry, and the
getSize method returns actual size of entry. The getTime method of ZipEntry class returns the
modification time of entry.
In this Example, The ZipFile class create an object of given zip file
and read entries. There are two method
of ZipEntry class ZipEntry.STORED and ZipEntry.DEFLATED.The entries() method of ZipFile class
returns enumeration of the zip file. The hasMoreElements() of method of Enumeration class checks
availability of entry. The nextElements() of Enumeration class returns next elements of enumeration.
The getName method of ZipEntry class return the name of associated entry. The getCompressedSize
method of zipEntry class returns actual compressed sized of entry.
About ZIPEntry API:
The java.util.zip.ZIPEntry class extends java.io.FilterIntputStream class. It provides the following methods:
|Boolean||getMethod()||The getMethod() returns compression method of associated entry.|
|String||getSize()||The getSize() method returns name actual size of associated entry.|
|void||getTime()||The getTime() method returns last modification time of associated entry.|
The entry Nmae data/ was stored at Tue Jul 20 15:58:28 GMT+05:30 2010
with a size of 0 bytes
The entry Nmae data/url.txt was deflated at Tue Jul 20 15:59:36 GMT+05:30 2010
Uncompressed size of entry : 437 bytes
Compressed size of entry : 291 bytes
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.