Java IO Tutorial - Java ZipFile.getName()








Syntax

ZipFile.getName() has the following syntax.

public String getName()

Example

In the following code shows how to use ZipFile.getName() method.

import java.io.File;
import java.util.Enumeration;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
//from w ww. j av  a 2 s.  c o m
public class Main {

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

    System.out.println(zipFile.getName());
  }
}