Package java.io

Examples of java.io.File.renameTo()


      }
     
    }

    project.getArtifact().getFile().delete();
    newOutput.renameTo(project.getArtifact().getFile());
   
  }

 
  public static final String PROPERTY_VERSION_APAM       = "apam.version";
View Full Code Here


        System.out.println("Could not delete file");
        return;
      }

      // Rename the new file to the filename the original file had.
      if (!tempFile.renameTo(inFile)) {
        System.out.println("Could not rename file");
      }
      // loadPlayList(PlayerUtils.currentPlayList);
    } catch (final FileNotFoundException ex) {
      ex.printStackTrace();
View Full Code Here

        String[] filesInEnv = env.getHome().list();
        SimpleDateFormat format = new SimpleDateFormat("yyyy_MM_dd_kk_mm_ss");
        String recordFileName = "backupset-" + format.format(new Date());
        File recordFile = new File(backupDir, recordFileName);
        if(recordFile.exists()) {
            recordFile.renameTo(new File(backupDir, recordFileName + ".old"));
        }

        PrintStream backupRecord = new PrintStream(new FileOutputStream(recordFile));
        backupRecord.println("Lastfile:" + Long.toHexString(backupHelper.getLastFileInBackupSet()));
        if(filesInEnv != null) {
View Full Code Here

            if (info.getDestJar().exists() && !info.getDestJar().delete()) {
                throw new IOException(
                    "Can't delete old jar file: " + info.getDestJar());
            }

            if (!tmpDest.renameTo(info.getDestJar())) {
                throw new IOException(
                    "Error renaming: " + tmpDest + " to " + info.getDestJar());
            }
        } catch (IOException ex) {
            throw new ProjectException("Error performing reconfiguration.", ex);
View Full Code Here

        if (currentLogFile != null) {
            File holder = currentLogFile;
            close();
            try {
                holder.renameTo(new File(newFileName));
            } catch (Throwable e) {
                log.error("rotate failed", e);
            }

            /* Make sure date is correct */
 
View Full Code Here

                            // Then delete the existing file
                            if (file.delete()) {
                                // Finally move the temporary file to the
                                // existing file location
                                boolean renameSuccessfull = false;
                                if ((tmp != null) && tmp.renameTo(file)) {
                                    if (request.getEntity() == null) {
                                        response
                                                .setStatus(Status.SUCCESS_NO_CONTENT);
                                    } else {
                                        response.setStatus(Status.SUCCESS_OK);
View Full Code Here

        if (newCss.exists()) {
            // Theme contained sprites. Renamed "styles-sprite.css" ->
            // "styles.css"
            oldCss.delete();

            boolean ok = newCss.renameTo(oldCss);
            if (!ok) {
                throw new RuntimeException("Rename " + newCss + " -> " + oldCss
                        + " failed");
            }
        }
View Full Code Here

      }
         

      if (!report.isPeriod()) {
        reports.add(reportFile);
        file.renameTo(new File(reportFile.substring(0, reportFile.indexOf(".temp"))));
      }

    } catch (Exception ex) {
      logger.error(ex, ex);
    } finally {
View Full Code Here

                File producedPng = getErrorFileFromReference(mainReference);
                File correctHtml = htmlFromPng(correctPng);
                File producedHtml = htmlFromPng(producedPng);

                producedPng.renameTo(correctPng);
                producedHtml.renameTo(correctHtml);
                referenceToKeep = exactVersionFile;
                screenshotFailures.add(exactVersionFile.getName());
            } else {
                // All comparisons failed, keep the main error image + HTML
                screenshotFailures.add(mainReference.getName());
View Full Code Here

    final String[] paramsLatex = {os.getLatexBinPath(), "--interaction=nonstopmode", "--output-directory=" + tmpDir2.getAbsolutePath(),//$NON-NLS-1$//$NON-NLS-2$
        texFile.getAbsolutePath()};
    log    = LSystem.INSTANCE.execute(paramsLatex, tmpDir2);
    final File dviFile = new File(tmpDir2.getAbsolutePath() + LResources.FILE_SEP + name + ".dvi"); //$NON-NLS-1$
    final boolean dviRenamed = dviFile.renameTo(new File(tmpDir2.getAbsolutePath() + LResources.FILE_SEP + name));

    final String[] paramsDvi = {os.getDvipsBinPath(), "-Pdownload35", "-T", //$NON-NLS-1$ //$NON-NLS-2$
        (tr.getX()-bl.getX())/ppc*scale+dec+"cm,"+((bl.getY()-tr.getY())/ppc*scale+dec)+"cm", //$NON-NLS-1$ //$NON-NLS-2$
            name, "-o", pathExportPs}; //$NON-NLS-1$
    log   += LSystem.INSTANCE.execute(paramsDvi, tmpDir2);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.