43 lines
1.3 KiB
Java
43 lines
1.3 KiB
Java
import java.io.IOException;
|
|
import java.nio.file.Files;
|
|
import java.nio.file.Path;
|
|
import java.nio.file.Paths;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
/**
|
|
* @author lvxinran
|
|
* @date 2019/11/5
|
|
* @discribe
|
|
*/
|
|
public class BIUtil {
|
|
public static void main(String[] args) {
|
|
outBIReasonFile("serverlogic\\src\\main\\java\\com\\ljsd\\jieling\\globals\\BIReason.java","conf\\BIoutput.txt");
|
|
}
|
|
public static void outBIReasonFile(String in,String out){
|
|
StringBuffer buf = new StringBuffer();
|
|
Path path = Paths.get(in);
|
|
try {
|
|
List<String> lines = Files.readAllLines(path);
|
|
lines.forEach(str -> buf.append(str));
|
|
} catch (IOException e) {
|
|
e.printStackTrace();
|
|
}
|
|
String replace = buf.toString().replace("}", "").replace(" ","");
|
|
String[] split = replace.split("=");
|
|
StringBuilder content = new StringBuilder();
|
|
for(String s:split){
|
|
String[] reason= s.split("int")[0].split(";//");
|
|
if(reason.length<2){
|
|
continue;
|
|
}
|
|
content.append(reason[0]).append("\t").append(reason[1].replaceAll(" ","")).append("\n");
|
|
}
|
|
try {
|
|
Files.write(Paths.get(out), content.toString().getBytes());
|
|
} catch (IOException e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|