Java IO Tutorial - Java ZipFile(File file, Charset charset) Constructor








Syntax

ZipFile(File file, Charset charset) constructor from ZipFile has the following syntax.

public ZipFile(File file,   Charset charset)  throws IOException

Example

In the following code shows how to use ZipFile.ZipFile(File file, Charset charset) constructor.

import java.io.File;
import java.nio.charset.Charset;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
//from w ww. ja va2 s  .  c  o  m
public class Main {

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