Reading a zip file from java using ZipInputStream
Java provides support for reading zip files in the form of ZipInputStream
. This class provides an API where you can iterate over all the items in a given zip file, reading the data from the archive for each file.
In order to do this, first you must create the ZipInputStream
instance giving the file that you wish to expand. Then you iterate using the getNextEntry
method on the stream, which returns the header data for each entry in turn. Importantly this does not contain the data, which is actually read from the stream separately.
In order to execute the example below, you need to provide two parameters, firstly the zip file that is to be processed, and secondly the output directory where the uncompressed files are to be stored.
Read full article from Reading a zip file from java using ZipInputStream
No comments:
Post a Comment