Monday, October 28, 2013

Read Zip file Using Java

Read zip file using Java





import 
java.io.FileInputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;

public class Main {

  public static void main(String[] argsthrows Exception {
    FileInputStream fis = new FileInputStream("C:/MyZip.zip");
    ZipInputStream zis = new ZipInputStream(fis);
    ZipEntry ze;
    while ((ze = zis.getNextEntry()) != null) {
      System.out.println(ze.getName());
      zis.closeEntry();
    }

    zis.close();

  }
}

No comments: