Java IO Tutorial - Java ZipFile.getEntry(String name)








Syntax

ZipFile.getEntry(String name) has the following syntax.

public ZipEntry getEntry(String name)

Example

In the following code shows how to use ZipFile.getEntry(String name) method.

//  w w  w .  ja v  a  2  s .com
import java.io.File;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;

public class Main {

  public static void main(String[] args) throws Exception {
    ZipFile zipFile = new ZipFile(new File("testfile.zip"),ZipFile.OPEN_READ);
    ZipEntry entry = zipFile.getEntry("fileName");
    
  }
}