首页 新闻 会员 周边

编写程序,实现Directories工具类,完成对目录的基本操作

0
悬赏园豆:30 [待解决问题]
  1. 编写程序,实现Directories工具类,完成对目录的基本操作。
    目录树形结构如图1所示。
    import java.util.List;

public class Directories {

/**
 * <p>递归搜索指定路径及子路径下的所有特定名称的文件夹或文件,支持模糊匹配.</p>
 * 
 * @param path  要搜索的起始路径
 * @param keyword   搜索的关键字
 * @return  文件绝对路径集合
 */
public static List<String> searchByFileName(String path, String keyword){

}

/**
 * <p>在指定目录及子目录下递归搜索所有特定后缀的文件.</p>
 * 
 * @param path 要搜索的起始路径
 * @param suff 文件后缀名,例如 doc, rar
 * @return 文件绝对路径集合
 */
public static List<String> searchBySuff(String path, String suff){

}

/**
 * <p>以树形结构形式递归打印特定路径下的文件及子目录.</p>
 * 
 * @param path 起始路径
 * @param depth 递归深度; 0表示不递归子目录,-1表示递归深度不限.
 */
public static void listDir(String path,int depth){

}

/**
 * <p>以树形结构递归罗列指定目录中的文件及子目录,并将结果输出到文本文件中保存.</p>
 * 
 * @param path 起始路径
 * @param depth 递归深度; 0表示不递归子目录,-1表示递归深度不限.
 * @param txtFilePath 结果文件路径
 */
public static void listDir (String path, int depth, String txtFilePath){

}
}

寂静的小青蛙的主页 寂静的小青蛙 | 初学一级 | 园豆:164
提问于:2018-10-15 13:57
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册