当前位置: 首页>>代码示例>>Java>>正文


Java PlatformManager.performRecoverableFileDelete方法代码示例

本文整理汇总了Java中org.gudy.azureus2.platform.PlatformManager.performRecoverableFileDelete方法的典型用法代码示例。如果您正苦于以下问题:Java PlatformManager.performRecoverableFileDelete方法的具体用法?Java PlatformManager.performRecoverableFileDelete怎么用?Java PlatformManager.performRecoverableFileDelete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.gudy.azureus2.platform.PlatformManager的用法示例。


在下文中一共展示了PlatformManager.performRecoverableFileDelete方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: deleteWithRecycle

import org.gudy.azureus2.platform.PlatformManager; //导入方法依赖的package包/类
public static boolean
deleteWithRecycle(
	File		file,
	boolean		force_no_recycle )
{
	if ( COConfigurationManager.getBooleanParameter("Move Deleted Data To Recycle Bin" ) && !force_no_recycle ){
		
		try{
		    final PlatformManager	platform  = PlatformManagerFactory.getPlatformManager();
		    
		    if (platform.hasCapability(PlatformManagerCapabilities.RecoverableFileDelete)){
		    	
		    	platform.performRecoverableFileDelete( file.getAbsolutePath());
		    
		    	return( true );
		    	
		    }else{
		    	
		    	return( file.delete());
		    }
		}catch( PlatformManagerException e ){
			
			return( file.delete());
		}
	}else{
		
		return( file.delete());
	}
}
 
开发者ID:thangbn,项目名称:Direct-File-Downloader,代码行数:30,代码来源:FileUtil.java

示例2: deleteDataFiles

import org.gudy.azureus2.platform.PlatformManager; //导入方法依赖的package包/类
/** Deletes all data files associated with torrent.
       * Currently, deletes all files, then tries to delete the path recursively
       * if the paths are empty.  An unexpected result may be that a empty
       * directory that the user created will be removed.
       *
       * TODO: only remove empty directories that are created for the torrent
       */

public static void
deleteDataFiles(
    TOTorrent   torrent,
    String      torrent_save_dir,       // enclosing dir, not for deletion
    String      torrent_save_file, 		// file or dir for torrent
    boolean		force_no_recycle )    
{
    if (torrent == null || torrent_save_file == null ){

        return;
    }

    try{
        if (torrent.isSimpleTorrent()){

            File    target = new File( torrent_save_dir, torrent_save_file );

            target = FMFileManagerFactory.getSingleton().getFileLink( torrent, target.getCanonicalFile());

            FileUtil.deleteWithRecycle( target, force_no_recycle );

        }else{

            PlatformManager mgr = PlatformManagerFactory.getPlatformManager();
            if( Constants.isOSX &&
                  torrent_save_file.length() > 0 &&
                  COConfigurationManager.getBooleanParameter("Move Deleted Data To Recycle Bin" ) &&
            		(! force_no_recycle ) &&
                  mgr.hasCapability(PlatformManagerCapabilities.RecoverableFileDelete) ) {

                try
                {
                    String  dir = torrent_save_dir + File.separatorChar + torrent_save_file + File.separatorChar;

                        // only delete the dir if there's only this torrent's files in it!

                    if ( countFiles( new File(dir)) == countDataFiles( torrent, torrent_save_dir, torrent_save_file )){

                        mgr.performRecoverableFileDelete( dir );

                    }else{

                        deleteDataFileContents( torrent, torrent_save_dir, torrent_save_file, force_no_recycle );
                }
                }
                catch(PlatformManagerException ex)
                {
                    deleteDataFileContents( torrent, torrent_save_dir, torrent_save_file, force_no_recycle );
                }
            }
            else{
                deleteDataFileContents(torrent, torrent_save_dir, torrent_save_file, force_no_recycle);
            }

        }
    }catch( Throwable e ){

        Debug.printStackTrace( e );
    }
}
 
开发者ID:thangbn,项目名称:Direct-File-Downloader,代码行数:69,代码来源:DiskManagerImpl.java

示例3: deleteDataFiles

import org.gudy.azureus2.platform.PlatformManager; //导入方法依赖的package包/类
/** Deletes all data files associated with torrent.
       * Currently, deletes all files, then tries to delete the path recursively
       * if the paths are empty.  An unexpected result may be that a empty
       * directory that the user created will be removed.
       *
       * TODO: only remove empty directories that are created for the torrent
       */

public static void
deleteDataFiles(
    TOTorrent   torrent,
    String      torrent_save_dir,       // enclosing dir, not for deletion
    String      torrent_save_file, 		// file or dir for torrent
    boolean		force_no_recycle )    
{
    if (torrent == null || torrent_save_file == null ){

        return;
    }

    try{
        if (torrent.isSimpleTorrent()){

            File    target = new File( torrent_save_dir, torrent_save_file );

            target = FMFileManagerFactory.getSingleton().getFileLink( torrent, 0, target.getCanonicalFile());

            FileUtil.deleteWithRecycle( target, force_no_recycle );

        }else{

            PlatformManager mgr = PlatformManagerFactory.getPlatformManager();
            if( Constants.isOSX &&
                  torrent_save_file.length() > 0 &&
                  COConfigurationManager.getBooleanParameter("Move Deleted Data To Recycle Bin" ) &&
            		(! force_no_recycle ) &&
                  mgr.hasCapability(PlatformManagerCapabilities.RecoverableFileDelete) ) {

                try
                {
                    String  dir = torrent_save_dir + File.separatorChar + torrent_save_file + File.separatorChar;

                        // only delete the dir if there's only this torrent's files in it!

                    if ( countFiles( new File(dir)) == countDataFiles( torrent, torrent_save_dir, torrent_save_file )){

                        mgr.performRecoverableFileDelete( dir );

                    }else{

                        deleteDataFileContents( torrent, torrent_save_dir, torrent_save_file, force_no_recycle );
                }
                }
                catch(PlatformManagerException ex)
                {
                    deleteDataFileContents( torrent, torrent_save_dir, torrent_save_file, force_no_recycle );
                }
            }
            else{
                deleteDataFileContents(torrent, torrent_save_dir, torrent_save_file, force_no_recycle);
            }

        }
    }catch( Throwable e ){

        Debug.printStackTrace( e );
    }
}
 
开发者ID:AcademicTorrents,项目名称:AcademicTorrents-Downloader,代码行数:69,代码来源:DiskManagerImpl.java

示例4: deleteDataFiles

import org.gudy.azureus2.platform.PlatformManager; //导入方法依赖的package包/类
/** Deletes all data files associated with torrent.
       * Currently, deletes all files, then tries to delete the path recursively
       * if the paths are empty.  An unexpected result may be that a empty
       * directory that the user created will be removed.
       *
       * TODO: only remove empty directories that are created for the torrent
       */

public static void
deleteDataFiles(
    TOTorrent   torrent,
    String      torrent_save_dir,       // enclosing dir, not for deletion
    String      torrent_save_file, 		// file or dir for torrent
    boolean		force_no_recycle )    
{
    if (torrent == null || torrent_save_file == null ){

        return;
    }

    try{
        if (torrent.isSimpleTorrent()){

            File    target = new File( torrent_save_dir, torrent_save_file );

            target = FMFileManagerFactory.getSingleton().getFileLink( torrent, 0, target.getCanonicalFile());

            FileUtil.deleteWithRecycle( target, force_no_recycle );

        }else{

            PlatformManager mgr = PlatformManagerFactory.getPlatformManager();
            if( Constants.isOSX &&
                  torrent_save_file.length() > 0 &&
                  COConfigurationManager.getBooleanParameter("Move Deleted Data To Recycle Bin" ) &&
            		(! force_no_recycle ) &&
                  mgr.hasCapability(PlatformManagerCapabilities.RecoverableFileDelete) ) {

                try
                {
                    String  dir = torrent_save_dir + File.separatorChar + torrent_save_file + File.separatorChar;

                        // only delete the dir if there's only this torrent's files in it!

                    int numDataFiles = countDataFiles( torrent, torrent_save_dir, torrent_save_file );
                    if ( countFiles( new File(dir), numDataFiles) == numDataFiles){

                        mgr.performRecoverableFileDelete( dir );

                    }else{

                        deleteDataFileContents( torrent, torrent_save_dir, torrent_save_file, force_no_recycle );
                }
                }
                catch(PlatformManagerException ex)
                {
                    deleteDataFileContents( torrent, torrent_save_dir, torrent_save_file, force_no_recycle );
                }
            }
            else{
                deleteDataFileContents(torrent, torrent_save_dir, torrent_save_file, force_no_recycle);
            }

        }
    }catch( Throwable e ){

        Debug.printStackTrace( e );
    }
}
 
开发者ID:AcademicTorrents,项目名称:AcademicTorrents-Downloader,代码行数:70,代码来源:DiskManagerImpl.java


注:本文中的org.gudy.azureus2.platform.PlatformManager.performRecoverableFileDelete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。