Java ZipFile(String name) Constructor
Syntax
ZipFile(String name) constructor from ZipFile has the following syntax.
public ZipFile(String name) throws IOException
Example
In the following code shows how to use ZipFile.ZipFile(String name) constructor.
import java.util.Enumeration;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
/*from ww w .ja v a2 s . com*/
public class Main {
public static void main(String[] args) throws Exception {
ZipFile zipFile = new ZipFile("testfile.zip");
Enumeration zipEntries = zipFile.entries();
while (zipEntries.hasMoreElements()) {
System.out.println(((ZipEntry) zipEntries.nextElement()).getName());
}
}
}