Package java.io

Examples of java.io.File.renameTo()


    {
      LOG.error("unable to erase temp SCN file: " + tempScnFile.getAbsolutePath());
    }

    File scnFile = new File(_scnFileName);
    if (scnFile.exists() && !scnFile.renameTo(tempScnFile))
    {
      LOG.error("unable to backup scn file");
    }

    if (!scnFile.createNewFile())
View Full Code Here


          LogHelper.logDebug("Message: " + e.getMessage() + ", cause: " + e.getCause());
          return;
        }
      }
      // rename homes.db to homes.db.done, so we don't attempt to convert again
      myHomes.renameTo(new File(plugin.getDataFolder(), "homes.db.done"));
     
      // all done, inform about successful conversion in the console
      LogHelper.logInfo("[CommandsEX] " + _("homeConversionDone", ""));
    }
  }
View Full Code Here

    outputDir = new File(outputDir.getAbsolutePath() + "-tmp");
    outputDir.mkdirs();
    ExtractReuters extractor = new ExtractReuters(reutersDir, outputDir);
    extractor.extract();
    // Now rename to requested output dir
    outputDir.renameTo(new File(args[1]));
  }

  private static void usage(String msg) {
    System.err.println("Usage: "+msg+" :: java -cp <...> org.apache.lucene.benchmark.utils.ExtractReuters <Path to Reuters SGM files> <Output Path>");
  }
View Full Code Here

                }
            }
        }

        // move temp file to final location
        if (!tempFile.renameTo(file)) {
            String deleteMsg = "";
            if (!tempFile.delete()) {
                deleteMsg = " and was unable to remove temp file " + tempFile.getAbsolutePath();
            }
            throw new IOException("Unable to move temp file (" + tempFile.getAbsolutePath() + ") to final location (" + file.getAbsolutePath() + ")" + deleteMsg);
View Full Code Here

    try {
      msg.writeDelimitedTo(outputStream);
      outputStream.getChannel().force(true);
      outputStream.close();
      closed = true;
      if(!tmp.renameTo(file)) {
        //Some platforms don't support moving over an existing file.
        //So:
        //log.meta -> log.meta.old
        //log.meta.tmp -> log.meta
        //delete log.meta.old
View Full Code Here

      //    then check if old exists.
      // In the above, we assume that if a file exists, it's integrity is ok.
      if (metaDataFile.exists()) {
        hasMeta = true;
      } else if (tempMetadataFile.exists()) {
        if (tempMetadataFile.renameTo(metaDataFile)) {
          hasMeta = true;
        } else {
          throw new IOException("Renaming of " + tempMetadataFile.getName()
                  + " to " + metaDataFile.getName() + " failed");
        }
View Full Code Here

  //  if(null == webhelpWar || webhelpWar.equals("0")){
      //TODO: Move dir to add warsuffix/security value
      //String sourceDir = result.getParentFile().getParentFile()  + "/" + warBasename ;
      File webhelpDirWithSecurity = new File(result.getParentFile().getParentFile(), warBasename + warSuffix);
      File webhelpOrigDir = new File(result.getParentFile().getParentFile(), webhelpOutdir );
      boolean success = webhelpOrigDir.renameTo(webhelpDirWithSecurity);
      //}
    }

    protected void copyTemplate(File result) throws MojoExecutionException {
View Full Code Here

      File tmp = FileUtil.createLocalTempFile(dst.getAbsoluteFile(), COPYTOLOCAL_PREFIX, true);
      if (!FileUtil.copy(srcFS, src, tmp, false, srcFS.getConf())) {
        throw new IOException("Failed to copy " + src + " to " + dst);
      }

      if (!tmp.renameTo(dst)) {
        throw new IOException("Failed to rename tmp file " + tmp + " to local destination \"" + dst + "\".");
      }

      if (copyCrc) {
        if (!(srcFS instanceof ChecksumFileSystem)) {
View Full Code Here

            // Do not delete in File
            m_helper.attachArtifact(m_project, "jar", m_classifier, out);
        } else {
            // Usual behavior
            if (in.delete()) {
                if (!out.renameTo(in)) {
                    getLog().warn("Cannot rename the manipulated jar file");
                }
            } else {
                getLog().warn("Cannot delete the input jar file");
            }
View Full Code Here

    {
        File part = new File(path.getPath() + ".part");
        saveTo(new FileOutputStream((part)));

        path.delete();
        if (!part.renameTo(path))
            throw new IOException("failed to rename " + part + " to " + path);
    }

    public void saveTo(OutputStream out)
    {
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.