项目场景:
项目场景:软著获取java 源代码文件,输出txt
package com.cdrundle;
import java.io.*;
/5用递归的方式得到所有工作空间中的.java文件,并输出service 实现类/
public class Lx5 {
public static void main(String[] args) throws IOException {
//这里写你需要的文件夹路径
File f = new File(“F:\cdc\test”);
File target = new File(“F:\cdc\test_service.txt”);
BufferedWriter bw = new BufferedWriter(new FileWriter(target));
StringBuilder sb = new StringBuilder();
printPathAndLength(f, sb);
write(sb.toString(), bw);
System.out.println("结束大小:" + sb.length());
}
public static void printPathAndLength(File f, StringBuilder sb) throws IOException {
if (f.isFile()) {
if (f.getName().endsWith(".java") && !(f.getName().matches("(.*)Mapper(.*)"))) {
if (f.getName().matches("(.*)ServiceImpl(.*)")) {