本文整理匯總了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());
}
}
示例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 );
}
}
示例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 );
}
}
示例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 );
}
}