Package java.io

Examples of java.io.File.renameTo()


          if (Logger.isEnabled())
            Logger.log(new LogEvent(LOGID, "renaming '" + name
                + "' to conform with versioning system"));

          jar_file.renameTo( new File( jar_file.getParent(), "i18nAZ_0.1.jar  " ));

          continue;
        }
      }
View Full Code Here


              + "] ===> [" + temp_user_path + "]";
          System.out.println(msg);
          Logger.log(new LogEvent(LOGID,
              "SystemProperties::getUserPath(Unix): " + msg));
          try {
            old_home.renameTo(home);
          } catch (Throwable t) {
            t.printStackTrace();
            Logger.log(new LogEvent(LOGID, "migration rename failed:", t));
          }
        }
View Full Code Here

         fos = null;

         //delete the old file
         if ( !oldFile.exists() || oldFile.delete() ) {
            //rename the new one
            newFile.renameTo(oldFile);
         }

      }
      catch (Exception e) {
        Debug.printStackTrace( e );
View Full Code Here

        new File(TEST_DIRECTORY).mkdirs();
        File backup = backup(TEST_DIRECTORY, BACKUP_DIRECTORY, "data", 10, NODE);
        System.out.println("check consistency...");
        if (!testConsistency()) {
            System.out.println("error! renaming file");
            backup.renameTo(new File(backup.getParentFile(), "error-" + backup.getName()));
        }
        System.out.println("deleting old run...");
        deleteRecursive(new File(TEST_DIRECTORY));
        System.out.println("testing...");
        testLoop();
View Full Code Here

        }
      }
    }
    newDocumentsObs.close();
    new File( basename + DOCUMENTS_EXTENSION ).delete();
    newDocumentsFile.renameTo( new File( basename + DOCUMENTS_EXTENSION ) );
    newDocumentsObs = null;
    invTermPerm = invNonTermPerm = null;
   
    FastBufferedInputStream termsStream = new FastBufferedInputStream( new FileInputStream( basename + TERMS_EXTENSION ) ) ;
    MutableString term[] = new MutableString[ (int)collection.terms ];
View Full Code Here

       
      }catch( Throwable e ){
       
        if ( backup_file != null ){
         
          backup_file.renameTo( file );
        }
       
        throw( new SubscriptionException( "File write failed: " + Debug.getNestedExceptionMessage(e)));
      }
    }catch( Throwable e ){
View Full Code Here

     */
    if (file.delete() == false) {
      throw new IOException(
          "Unable to delete original file during flushByCopy()");
    }
    if (temp.renameTo(file) == false) {
      throw new IOException(
          "Unable to move temporary file during flushByCopy()");
    }

    final String accessMode = (mode.isContent() ? "rw" : "r");
View Full Code Here

        if (settingsFile.isFile() == false || settingsFile.length() == 0 ) {
            // try to restore .bak file
            final String configDirStr = getValue(SettingsClass.DIR_CONFIG);
            final File bakFile = new File(configDirStr + "frost.ini.bak");
            if( bakFile.isFile() && bakFile.length() > 0 ) {
                bakFile.renameTo(settingsFile);
            } else {
                return false;
            }
        }
View Full Code Here

        }

        oldFile.delete();

        if( bakFile.isFile() ) {
            bakFile.renameTo(oldFile);
        }

        if( settingsFile.isFile() && settingsFile.length() > 0 ) {
            settingsFile.renameTo(bakFile); // settingsFile keeps old name!
        }
View Full Code Here

    sUniqueName = (sExt.length()==0 ? sLocationId : sLocationId + "." + sExt);

    oOldFile = new File(sPath + sFile);
    iFileLen = new Long(oOldFile.length()).intValue();
    oOldFile.renameTo(new File(sPath + sUniqueName));
    oOldFile = null;

    if (null!=oConn && null!=sLocationId) {
      oStmt = oConn.prepareStatement("UPDATE " + DB.k_prod_locats + " SET " + DB.xfile + "=?," + DB.len_file + "=? WHERE " + DB.gu_location + "=?");
      oStmt.setString(1, sUniqueName);
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.