In this tutorial, We will discuss the use of size and getInputStream
method. These methods
are available in ZipFile class. The ZipFile
class is used to read entries from zip files.
In this Example, The size() method of ZipFile class returns number of entries
in zip file, and
the getInputStream method returns a input stream for reading
the contents of zip file entry.
The getName
method of ZipEntry class return the name of associated entry. The
hasMoreElements method of Enumeration class checks enumeration has
more
elements, and nextElements returns next elements.
About ZIPEntry API:
| Return Type | Method | Description |
| int | size() | The method size() returns the number of entry in a associated zip file. |
| InputStream | geInputStream() | The method getInputStream() returns a input stream for reading the contents of associated zip file entry. |
import java.io.*; |
| C:\java ZipGetInStream Total number of entries in a zip file :2 Name of Extract file :Document.txt Name of Extract file :bharat.txt |
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.