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








Syntax

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

public ZipFile(File file,  int mode,   Charset charset)  throws IOException

Example

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

import java.io.File;
import java.nio.charset.Charset;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
/*www.  j a  v  a2 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,Charset.defaultCharset());
    ZipEntry entry = zipFile.getEntry("fileName");
    
  }
}