剔除java反编译文件后的无效注释信息
来源:互联网 发布:电子科大网络 编辑:程序博客网 时间:2024/06/01 08:33
import java.io.BufferedReader;import java.io.BufferedWriter;import java.io.File;import java.io.FileInputStream;import java.io.FileOutputStream;import java.io.IOException;import java.io.InputStream;import java.io.InputStreamReader;import java.io.OutputStream;import java.io.OutputStreamWriter;public class CopyJava { public static void main(String[] args) throws IOException { copy("源路径", "目标路径"); // 这里写好源文件夹和目的文件夹 System.out.println("ok"); } private static void copy(String srcPath, String descPath) throws IOException { copy(new File(srcPath), new File(descPath)); } private static void copy(File srcFile, File descFile) throws IOException { if (srcFile.isFile()) { // 文件 File parent = descFile.getParentFile(); if (!parent.exists()) { parent.mkdirs(); // 创建文件夹 } if (srcFile.getName().endsWith(".java")) { copyJava(srcFile, descFile); } else { copyFile(srcFile, descFile); } } else { // 文件夹 for (File file : srcFile.listFiles()) { // 相对路径 String srcPath = file.getAbsolutePath().substring( srcFile.getAbsolutePath().length()); copy(file, new File(descFile.getAbsolutePath() + srcPath)); } } } private static void copyJava(File srcFile, File descFile) throws IOException { BufferedWriter bw = new BufferedWriter(new OutputStreamWriter( new FileOutputStream(descFile))); BufferedReader br = new BufferedReader(new InputStreamReader( new FileInputStream(srcFile))); String line; while ((line = br.readLine()) != null) { bw.write(line.replaceFirst(".*/\\*(.*)\\*/", "")); // 注意这里,如果不行,要适当修改 bw.write("\n"); } br.close(); bw.close(); } private static void copyFile(File srcFile, File descFile) throws IOException { OutputStream output = new FileOutputStream(descFile); InputStream input = new FileInputStream(srcFile); byte[] buffer = new byte[1024 * 4]; int n = 0; while ((n = input.read(buffer)) != -1) { output.write(buffer, 0, n); } input.close(); output.close(); }}
0 0
- 剔除java反编译文件后的无效注释信息
- jd-gui反编译jar后清除后面的注释信息
- java文件流处理jd-gui反编译后文件中每行的注释符
- 去掉java中的注释(尤其针对反编译后的文件)
- java class文件反编译 去掉无用注释
- 除去反编译后的java文件的乱码
- 剔除xcode删除文件后出现的missfile错误
- java用工具反编译后出现的垃圾注释去除方案
- java文件编译后包含的信息
- Java实现-数组剔除元素后的乘积
- java正则表达式剔除HTML注释
- 剔除consul上无效的服务实例
- 只使用awk去除配置文件的注释等无效信息
- 使用反编译后的so文件
- Java的class文件反编译
- java的class文件反编译
- 修改hosts文件无效后的解决方法
- java class反编译后的代码还原
- python学习日记_第二天(ex1~5)
- C# 16进制与字符串、字节数组之间的转换(转)
- 大型web系统数据缓存设计
- 浅谈Android系统启动过程
- Android-Styles and Themes
- 剔除java反编译文件后的无效注释信息
- Android编译遇到点9图片错误:No marked region found along edge. - Found along left edge.
- Edit Distance相似度算法
- 【cocos2d-js系列问题】cocos2d-js创建帧动画的两种方法
- Unity局部高效实时阴影的思考和实现
- 读取dll所在路径
- 【Mark】谁能从事最具幸福感的职业
- 自己理解的Jaccard相似度算法实现
- mysql去重distinct和group by