public boolean renameTo(String name) { return delegate.renameTo(name); }
/** * rename a tmp file * * @param from name * @param to name */ protected boolean renameTmp(String from, String to) throws IOException { ReadableArchive finalArchive = archiveFactory.openArchive(new File(to)); finalArchive.delete(); ReadableArchive tmpArchive = archiveFactory.openArchive(new File(from)); boolean success = tmpArchive.renameTo(to); if (!success) { throw new IOException("Error renaming JAR"); } return success; }
/** * rename a tmp file * * @param from name * @param to name */ protected boolean renameTmp(String from, String to) throws IOException { ReadableArchive finalArchive = archiveFactory.openArchive(new File(to)); finalArchive.delete(); ReadableArchive tmpArchive = archiveFactory.openArchive(new File(from)); boolean success = tmpArchive.renameTo(to); if (!success) { throw new IOException("Error renaming JAR"); } return success; }
public void saveRuntimeInfo(File output) throws IOException { // if output file is null, we overwrite the current archive... File outputFile = output; if (outputFile == null) { outputFile = getTempFile(path); } // copy all entries from source to target except the // runtime descriptor file WritableArchive out = archiveFactory.createArchive(outputFile); ReadableArchive in = archiveFactory.openArchive(new File(path)); Vector skipFiles = new Vector(); skipFiles.add(getRuntimeDeploymentDescriptorPath()); copyInto(in, out, skipFiles); in.close(); // now save the runtime deployment descriptor... OutputStream os = out.putNextEntry(getRuntimeDeploymentDescriptorPath()); writeRuntimeDeploymentDescriptors(os); out.closeEntry(); out.close(); // if we overwrote the old archive, need to rename the tmp now if (output == null) { ReadableArchive finalArchive = archiveFactory.openArchive(new File(path)); finalArchive.delete(); ReadableArchive tmpArchive = archiveFactory.openArchive(outputFile); tmpArchive.renameTo(path); } }
finalArchive.delete(); ReadableArchive tmpArchive = archiveFactory.openArchive(outputFile); tmpArchive.renameTo(outPath);
finalArchive.delete(); ReadableArchive tmpArchive = archiveFactory.openArchive(outputFile); tmpArchive.renameTo(outPath);