android的文件、目录操作(四)

来源:互联网 发布:windows激活工具kms 编辑:程序博客网 时间:2024/05/19 23:13
 

android的文件、目录操作(四)  

2011-03-18 18:08:20|  分类:工作学习 |  标签:|字号 订阅


  1.     /** 
  2.      * 删除私有文件 
  3.      *  
  4.      * @param fileName 
  5.      * @return 
  6.      */  
  7.     public boolean delDataFile(String fileName) {  
  8.         File file = new File(FILESPATH + fileName);  
  9.         return delFile(file);  
  10.     }  
  11.   
  12.     /** 
  13.      * 删除私有目录 
  14.      *  
  15.      * @param dirName 
  16.      * @return 
  17.      */  
  18.     public boolean delDataDir(String dirName) {  
  19.         File file = new File(FILESPATH + dirName);  
  20.         return delDir(file);  
  21.     }  
  22.   
  23.     /** 
  24.      * 更改私有文件名 
  25.      *  
  26.      * @param oldName 
  27.      * @param newName 
  28.      * @return 
  29.      */  
  30.     public boolean renameDataFile(String oldName, String newName) {  
  31.         File oldFile = new File(FILESPATH + oldName);  
  32.         File newFile = new File(FILESPATH + newName);  
  33.         return oldFile.renameTo(newFile);  
  34.     }  
  35.   
  36.     /** 
  37.      * 在私有目录下进行文件复制 
  38.      *  
  39.      * @param srcFileName 
  40.      *            : 包含路径及文件名 
  41.      * @param destFileName 
  42.      * @return 
  43.      * @throws IOException 
  44.      */  
  45.     public boolean copyDataFileTo(String srcFileName, String destFileName)  
  46.             throws IOException {  
  47.         File srcFile = new File(FILESPATH + srcFileName);  
  48.         File destFile = new File(FILESPATH + destFileName);  
  49.         return copyFileTo(srcFile, destFile);  
  50.     }  
  51.   
  52.     /** 
  53.      * 复制私有目录里指定目录的所有文件 
  54.      *  
  55.      * @param srcDirName 
  56.      * @param destDirName 
  57.      * @return 
  58.      * @throws IOException 
  59.      */  
  60.     public boolean copyDataFilesTo(String srcDirName, String destDirName)  
  61.             throws IOException {  
  62.         File srcDir = new File(FILESPATH + srcDirName);  
  63.         File destDir = new File(FILESPATH + destDirName);  
  64.         return copyFilesTo(srcDir, destDir);  
  65.     }  
  66.   
  67.     /** 
  68.      * 移动私有目录下的单个文件 
  69.      *  
  70.      * @param srcFileName 
  71.      * @param destFileName 
  72.      * @return 
  73.      * @throws IOException 
  74.      */  
  75.     public boolean moveDataFileTo(String srcFileName, String destFileName)  
  76.             throws IOException {  
  77.         File srcFile = new File(FILESPATH + srcFileName);  
  78.         File destFile = new File(FILESPATH + destFileName);  
  79.         return moveFileTo(srcFile, destFile);  
  80.     }  
  81.   
  82.     /** 
  83.      * 移动私有目录下的指定目录下的所有文件 
  84.      *  
  85.      * @param srcDirName 
  86.      * @param destDirName 
  87.      * @return 
  88.      * @throws IOException 
  89.      */  
  90.     public boolean moveDataFilesTo(String srcDirName, String destDirName)  
  91.             throws IOException {  
  92.         File srcDir = new File(FILESPATH + srcDirName);  
  93.         File destDir = new File(FILESPATH + destDirName);  
  94.         return moveFilesTo(srcDir, destDir);  
  95.     } 
原创粉丝点击