/** * Create a temporary File from a given entry of a given ZipFile. You must * delete the temp file after using it. * * @param zipFile * the Zipped file to search in, must be non null * @param entryName * the name of an entry in the Zip file, must be non null and non * empty * @throws PetalsException * if entry can't be found or if an error occured during zip * reading * @throws IOException * @return a temp File read from the Zip entry, not <code>null</code>. */ public static File getEntryAsTemp(ZipFile zipFile, String entryName) throws PetalsException, IOException { File tempFile = null; InputStream zipStream = null; ZipEntry theEntry = getZipEntry(zipFile, entryName); zipStream = zipFile.getInputStream(theEntry); tempFile = File.createTempFile("petals-", null); NioUtil.copyStreamToFile(zipStream, tempFile); return tempFile; }