Examples of renameTo()


Examples of java.io.File.renameTo()

            os.write(i.next().bytes());
            c++;
        }
        os.flush();
        os.close();
        tmp.renameTo(file);
        assert file.exists() : file.toString();
        assert !tmp.exists() : tmp.toString();
        return c;
    }
View Full Code Here

Examples of java.io.File.renameTo()

            os.writeInt(e.getValue().intValue());
            c++;
        }
        os.flush();
        os.close();
        tmp.renameTo(file);
        assert file.exists() : file.toString();
        assert !tmp.exists() : tmp.toString();
       
        return c;
    }
View Full Code Here

Examples of java.io.File.renameTo()

            if ((tablefile[i].startsWith(prefix)) &&
                (tablefile[i].charAt(prefix.length()) == '.') &&
                (tablefile[i].length() == prefix.length() + 7)) {
                f = new File(path, tablefile[i]);
                String newname = tablefile[i] + "0100000" + (Long.toString(r.nextLong())+"00000").substring(1,5) + ".table";
                f.renameTo(new File(path, newname));
            }
        }
        // read new list again
        tablefile = path.list();
       
View Full Code Here

Examples of java.io.File.renameTo()

    HeaderInfoWriter writer = new HeaderInfoWriter(info);
    try {
      String spool = file + ".spool";
      writer.write(spool);
      File f = new File(spool);
      if (f.renameTo(new File(file))) {
        info.setModified(false);
      }
      return true;
    } catch (IOException e) {
      JOptionPane.showMessageDialog(null,"Error writing " + file +" " + e, "Save Error", JOptionPane.ERROR_MESSAGE);
View Full Code Here

Examples of java.io.File.renameTo()

    CdtWriter writer = new CdtWriter(dataModel);
    try {
      String spool = file + ".spool";
      writer.write(spool);
      File f = new File(spool);
      if (f.renameTo(new File(file))) {
        dataModel.getDataMatrix().setModified(false);
        dataModel.getArrayHeaderInfo().setModified(false);
        dataModel.getGeneHeaderInfo().setModified(false);
      }
      return true;
View Full Code Here

Examples of java.io.File.renameTo()

      fos.write((header_+System.getProperty("line.separator")).getBytes(StringHelper.check4xMacRoman(charSet)));
      FileUtils.copy(fis, fos);
      fis.close();
      fos.close();
      outFile.delete();
      tmpOutFile.renameTo(outFile);
     
      log_.info("exportCourseLog: resulting outfile="+outFile.getAbsolutePath());
    } catch(RuntimeException e) {
      String details = "outFile="+outFile.getAbsolutePath()+", resAdminAction="+resourceAdminAction+", resourceableId="+resourceableId+", anonymize="+anonymize+", begin="+(begin==null ? null : begin.getTime())+", end="+(end==null ? null : end.getTime());
      log_.error("exportCourseLog: runtime exception. Details: "+details,e);
View Full Code Here

Examples of java.io.File.renameTo()

     * operation.
     */
    private boolean renameWithOverwrite(String oldname, String newname) {

        File    file    = new File(oldname);
        boolean renamed = file.renameTo(new File(newname));

        if (renamed) {
            return true;
        }

View Full Code Here

Examples of java.io.File.renameTo()

        if (renamed) {
            return true;
        }

        if (delete(newname)) {
            return file.renameTo(new File(newname));
        }

        return false;
    }
View Full Code Here

Examples of java.io.File.renameTo()

      if ( !jarFile.delete() )
        throw new Exception("cannot delete old "+oldJar.getCanonicalPath());
     
      File newJar = new File(tempfile);
     
      if ( !newJar.renameTo(oldJar) )
        throw new Exception("cannot rename tempfile "+tempfile+" to "+oldJar.getCanonicalPath());
     
    } catch (Exception e) {
      throw new Exception("cannot update jar: "+e.getMessage());
    }
View Full Code Here

Examples of java.io.File.renameTo()

      throw (new Exception(SOSClassUtil.getMethodName() + ": " + e.toString()));
    }
    finally {
      if (outFile != null)
        try {
          outFile.renameTo(inFile);
        }
        catch (Exception ex) {
        }
      if (in != null)
        try {
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.