In this Example, we will discuss the use of ZipEntry class The ZipEntry class is used to show the entry in ZIP file and also property Name and size of data etc. The ZipEntry class is available in java.util.zip package.
In this Example, we will discuss about the ZIP file entry. The ZipEntry class create a instance of zip entry which represent Zip file entry. . The getNextEntry method of ZipInputStream class is used to read next ZIP file entry and position at the beginning of the entry data, and the getName method of ZipEntry class return the name of associated entry. And the getCompressSize methed of ZipEntry class return compress size of entry. The getSize methed of ZipEntry class return actual size of entry.
About ZIPEntry API:
|long||getCompressSize()||The method getCompressedSize() return compressed Size of entry.|
|String||getName()||The method getName() returns name of the associated entry.|
|long||getSize()||The method getSize() returns the actual size of current entry.|
Name of Entry in Given Zip file : testfile2.txt
Size of Entry in Given Zip file is : 83 byte
Actual Size of Entry is : 180 byte
Name of Entry in Given Zip file : testfile1.txt
Size of Entry in Given Zip file is : 32 byte
Actual Size of Entry is : 34 byte
Posted on: July 14, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles