Here you can find the source of getZipFile(File src, Charset charset)
static ZipFile getZipFile(File src, Charset charset) throws IOException
//package com.java2s; //License from project: Apache License import java.io.File; import java.io.IOException; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.nio.charset.Charset; import java.util.zip.ZipFile; public class Main { private static final String MISSING_METHOD_PLEASE_UPGRADE = "Your JRE doesn't support the ZipFile Charset constructor. Please upgrade JRE to 1.7 use this feature. Tried constructor ZipFile(File, Charset)."; private static final String CONSTRUCTOR_MESSAGE_FOR_ZIPFILE = "Using constructor ZipFile(File, Charset) has failed: "; /**/* w w w . j a v a2 s . co m*/ * Returns a zipFile opened with a given charset */ static ZipFile getZipFile(File src, Charset charset) throws IOException { if (charset == null) { return new ZipFile(src); } try { Constructor<ZipFile> constructor = ZipFile.class .getConstructor(new Class[] { File.class, Charset.class }); return (ZipFile) constructor.newInstance(new Object[] { src, charset }); } catch (NoSuchMethodException e) { throw new IllegalStateException(MISSING_METHOD_PLEASE_UPGRADE, e); } catch (InstantiationException e) { throw new IllegalStateException(CONSTRUCTOR_MESSAGE_FOR_ZIPFILE + e.getMessage(), e); } catch (IllegalAccessException e) { throw new IllegalStateException(CONSTRUCTOR_MESSAGE_FOR_ZIPFILE + e.getMessage(), e); } catch (IllegalArgumentException e) { throw new IllegalStateException(CONSTRUCTOR_MESSAGE_FOR_ZIPFILE + e.getMessage(), e); } catch (InvocationTargetException e) { throw new IllegalStateException(CONSTRUCTOR_MESSAGE_FOR_ZIPFILE + e.getMessage(), e); } } }