Package com.aelitis.azureus.core.diskmanager.file

Examples of com.aelitis.azureus.core.diskmanager.file.FMFileManagerException


      */
     
      if ( !new File(controlFileDir,controlFileName).exists()){
       
        if (!controlFileDir.isDirectory() && !FileUtil.mkdirs(controlFileDir)) {
          throw new FMFileManagerException("Directory creation failed: "  + controlFileDir);
        }
     
        if(current_length > 0)
        {
          write_required  = true;
          writeState();
        }
         
       
      }else{
       
        readState();
      }
    }catch( Throwable e ){
     
      throw( new FMFileManagerException( "Compact file init fail", e ));
    }
  }
View Full Code Here


       
        current_length  = length.longValue();
      }
    }catch( Throwable e ){
     
      throw( new FMFileManagerException( "Failed to read control file state", e ));
    }
  }
View Full Code Here

        FileUtil.writeResilientFile(
            controlFileDir, controlFileName, data, false );
       
      }catch( Throwable e ){
       
        throw( new FMFileManagerException( "Failed to write control file state", e ));
      }
    }
  }
View Full Code Here

      if ( e instanceof FMFileManagerException ){
       
        throw((FMFileManagerException)e);
      }
     
      throw( new FMFileManagerException( "initialisation failed", e ));
     
    }finally{
     
      if ( file_reserved && !ok ){
       
View Full Code Here

      if ( e instanceof FMFileManagerException ){
       
        throw((FMFileManagerException)e);
      }
     
      throw( new FMFileManagerException( "initialisation failed", e ));
    }
  }
View Full Code Here

              throw ioe;
            }
           
      }catch( Throwable e ){
       
        throw( new FMFileManagerException( "getCanonicalPath fails", e ));
     
     
      if ( new_linked_file.exists()){
       
        throw( new FMFileManagerException( "moveFile fails - file '" + new_canonical_path + "' already exists"))
      }
     
      boolean  was_open  = isOpen();
     
      close()// full close, this will release any slots in the limited file case
     
      createDirs( new_linked_file );
         
      if ( !linked_file.exists() || FileUtil.renameFile( linked_file, new_linked_file )) {
       
        linked_file    = new_linked_file;
        canonical_path  = new_canonical_path;
       
        reserveFile();
       
        if ( was_open ){
         
          ensureOpen( "moveFile target" )// ensure open will regain slots in limited file case
        }
       
      }else{
     
        try{
          reserveFile();
         
        }catch( FMFileManagerException e ){
         
          Debug.printStackTrace( e );
        }
       
        if ( was_open ){
         
          try{
            ensureOpen( "moveFile recovery" );
           
          }catch( FMFileManagerException e){
           
            Debug.printStackTrace( e );
          }
        }
       
        throw( new FMFileManagerException( "moveFile fails"));
     
    }finally{
     
      this_mon.exit();
    }
View Full Code Here

              throw ioe;
            }
           
      }catch( Throwable e ){
       
        throw( new FMFileManagerException( "getCanonicalPath fails", e ));
     
     
      if ( new_linked_file.exists()){
       
        throw( new FMFileManagerException( "renameFile fails - file '" + new_canonical_path + "' already exists"))
      }
     
      boolean  was_open  = isOpen();
     
      close()// full close, this will release any slots in the limited file case
               
      if ( !linked_file.exists() || linked_file.renameTo( new_linked_file )){
       
        linked_file    = new_linked_file;
        canonical_path  = new_canonical_path;
       
        reserveFile();
       
        if ( was_open ){
         
          ensureOpen( "renameFile target" )// ensure open will regain slots in limited file case
        }
       
      }else{
     
        try{
          reserveFile();
         
        }catch( FMFileManagerException e ){
         
          Debug.printStackTrace( e );
        }
       
        if ( was_open ){
         
          try{
            ensureOpen( "renameFile recovery" );
           
          }catch( FMFileManagerException e){
           
            Debug.printStackTrace( e );
          }
        }
       
        throw( new FMFileManagerException( "renameFile fails"));
     
    }finally{
     
      this_mon.exit();
    }
View Full Code Here

 
    throws FMFileManagerException
  {
    if ( raf != null ){
     
      throw( new FMFileManagerException( "file already open" ));
    }

    reserveAccess( reason );
   
    try
      file_access.aboutToOpen();
     
      raf = new RandomAccessFile( linked_file, access_mode==FM_READ?READ_ACCESS_MODE:WRITE_ACCESS_MODE);
     
    }catch( Throwable e ){
     
      Debug.printStackTrace( e );
     
      throw( new FMFileManagerException( "open fails", e ));
    }
  }
View Full Code Here

  closeSupport(
    boolean    explicit )
 
    throws FMFileManagerException
  {
    FMFileManagerException  flush_exception = null;
   
    try{
      flush();
     
    }catch( FMFileManagerException e ){
   
      flush_exception = e;
    }
   
    if ( raf == null ){
     
        // may have previously been implicitly closed, tidy up if required
     
      if ( explicit ){
       
        releaseFile();
       
        deleteDirs();
      }
    }else{
   
      try{     
        raf.close();
               
      }catch( Throwable e ){
       
        throw( new FMFileManagerException("close fails", e ));
       
      }finally{
             
        raf  = null;
       
View Full Code Here

   
    if ( linked_file.exists()){
     
      if ( !linked_file.delete()){
       
        throw( new FMFileManagerException( "Failed to delete '" + linked_file + "'" ));
      }
    }
  }
View Full Code Here

TOP

Related Classes of com.aelitis.azureus.core.diskmanager.file.FMFileManagerException

Copyright © 2018 www.massapicom. 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.