/** * Unzips a zip a file to a specified directory, deleting the zip file after unpacking. * * @param zipFile The zip file. * @param outputDirectory The directory to unpack the contents to. * * @throws IOException Any I/O errors that occur. * * TODO: move this to IOUtils */ public static void unzipFile( File zipFile, File outputDirectory ) throws IOException { if ( outputDirectory == null ) { outputDirectory = zipFile.getParentFile(); } if ( outputDirectory != null && !outputDirectory.exists() ) { outputDirectory.mkdir(); } ZipFile archive = new ZipFile(zipFile); IOUtils.inflate(archive, outputDirectory, null); IOUtils.deleteFile(zipFile); }