/** * Extracts all files that have a given extension from a given JAR file to a given target * directory. To extract files without extension, use <code>null</code> as the * <code>fileExt</code> parameter. * * @param jarFile * The given JAR file. * @param fileExt * The given file extension. * @param targetDir * The given target directory. * @return Total number of bytes extracted. * @throws IOException * If any I/O exception occurred. */ public static long extractFilesWithExtFromJar(JarFile jarFile, String fileExt, File targetDir) throws IOException { return extractFilesFromJar(jarFile, targetDir, new DirFileFilter(null, fileExt)); }
/** * Extracts all files in a given JAR directory (including all its subdirectories) from a given JAR * file to a given target directory. * * @param jarFile * The given JAR file. * @param dirPath * The given JAR directory. * @param targetDir * The given target directory. * @return Total number of bytes extracted. * @throws IOException * If any I/O exception occurred. */ public static long extractDirectoryFromJar(JarFile jarFile, String dirPath, File targetDir) throws IOException { return extractFilesFromJar(jarFile, targetDir, new DirFileFilter(dirPath, null)); }