Examples of renameTo()


Examples of java.io.File.renameTo()

      outputStream.close();

      // Now that we have the generated file, move it to its proper location
      if (!configFile.delete())
         throw new Exception("Update failed for '" + name + "', unable to delete old configuration file: " + path);
      if (!outputFile.renameTo(configFile))
         throw new Exception("Update failed for '" + name + "', unable to move configuration file to deploy directory: " + path);
   }
}
View Full Code Here

Examples of java.io.File.renameTo()

      fc.close();
      fos.close();
      raf.close();
      if( javaFile.delete() == false )
         log.severe("Failed to delete java file: "+javaFile);
      if( bakFile.renameTo(javaFile) == false )
         throw new SyncFailedException("Failed to replace: "+javaFile);
   }

   /**
    * Add the default jboss lgpl header
View Full Code Here

Examples of java.io.File.renameTo()

      // temporary form item scope. The file must be moved later using the
      // moveUploadFileTo() method to the final destination.
      tempUploadFile = new File(WebappHelper.getUserDataRoot() + "/tmp/" + CodeHelper.getGlobalForeverUniqueID());
      File tmpRequestFile = getRootForm().getRequestMultipartFile(component.getFormDispatchId());
      // Move file to internal temp location
      boolean success = tmpRequestFile.renameTo(tempUploadFile);
      if (!success) {
        // try to move file by copying it, command above might fail
        // when source and target are on different volumes
        FileUtils.copyFileToFile(tmpRequestFile, tempUploadFile, true);
      }
View Full Code Here

Examples of java.io.File.renameTo()

            xmlenc.writeObject(tables);
            xmlenc.close();
           
            // delete old file and rename tmp-file to old file's name
            FileUtils.deletedelete(this.propFile);
            tmpFile.renameTo(this.propFile);

            // set the new time stamp
            timestamp = System.currentTimeMillis();
        }
    }
View Full Code Here

Examples of java.io.File.renameTo()

                e.writeXML(osw);
                c++;
                if (c >= maxEntriesInFile) {
                    osw.write("</surrogates>\n");
                    osw.close();
                    outputfiletmp.renameTo(outputfile);
                    osw = null;
                    c = 0;
                    fc++;
                }
            }
View Full Code Here

Examples of java.io.File.renameTo()

                    fc++;
                }
            }
            osw.write(SurrogateReader.SURROGATES_MAIN_ELEMENT_CLOSE + "\n");
            osw.close();
            outputfiletmp.renameTo(outputfile);
            return fc + 1;
        } catch (MalformedURLException e) {
            Log.logException(e);
        } catch (UnsupportedEncodingException e) {
            Log.logException(e);
View Full Code Here

Examples of java.io.File.renameTo()

   
    public static void integrateOpenGeoDB() {
        File geo1 = Dictionary.GEODB1.file();
        File geo0 = Dictionary.GEODB0.file();
        if (geo1.exists()) {
            if (geo0.exists()) geo0.renameTo(Dictionary.GEODB0.fileDisabled());
            geoLoc.addLocalization(Dictionary.GEODB1.nickname, new OpenGeoDBLocalization(geo1, false));
            return;
        }
        if (geo0.exists()) {
            geoLoc.addLocalization(Dictionary.GEODB0.nickname, new OpenGeoDBLocalization(geo0, false));
View Full Code Here

Examples of java.io.File.renameTo()

        final File f1 = new File(targetDir, OAIPMHImporter.filename4Source(source));
        final File f0 = new File(targetDir, f1.getName() + ".tmp");

        // transaction-safe writing
        FileUtils.copy(b, f0);
        f0.renameTo(f1);

        /*
        SurrogateReader sr = new SurrogateReader(new ByteArrayInputStream(b), 100);
        Thread srt = new Thread(sr);
        srt.start();
View Full Code Here

Examples of java.io.File.renameTo()

            out.close();
            zf.close();
            if (!f.delete()) {
                throw new IOException("Cannot delete file " + f);
            }
            if (!g.renameTo(f)) {
                throw new IOException("Cannot rename file " + g);
            }
        }
    }
View Full Code Here

Examples of java.io.File.renameTo()

               if (f.length() == 0) {
                   f.delete();
                   deletions = true;
               } else try {
                   d = GenericFormatter.SHORT_SECOND_FORMATTER.parse(files[i].substring(0, 14));
                   f.renameTo(newBLOB(d));
                   deletions = true;
               } catch (ParseException e) {continue;}
            }
        }
        if (deletions) files = heapLocation.list(); // make a fresh list
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.