个人项目-过滤代码工程文件注释
来源:互联网 发布:淘宝订单贷款能用多久 编辑:程序博客网 时间:2024/06/05 04:43
功能介绍:
对代码工程中的(如java,jsp,c++,xml,html,js,properties,py等类型)文件注释进行过滤删除,以减少代码的占用空间和打包后的大小等。
实例:
package org.slive.project.style;import java.util.ArrayList;import java.util.List;import java.util.Set;import org.slive.project.style.formatter.CommentFilter;import org.slive.project.style.formatter.conf.CommentConfig;import org.slive.project.style.formatter.conf.CommentType;public class TestMain { public static void main(String[] args) { String prjPath = "E:/DevPrjs/Git/org.slive.project.style/"; String destPrjPath = "E:/DevPrjs/Git/bak/org.slive.project.style/"; long startTime = System.currentTimeMillis(); System.out.println("测试开始。"); System.out.println("源项目:" + prjPath); System.out.println("目标项目:" + prjPath); List<CommentConfig> confs = new ArrayList<>(); CommentConfig c0 = new CommentConfig(); // 处理文件类型 c0.setFileTypeSuffix("java"); // 过滤掉"//","/* */"的注释 Set<CommentType> commentFilters = c0.getCommentTypes(); commentFilters.add(new CommentType("//")); commentFilters.add(new CommentType("/*", "*/")); confs.add(c0); CommentConfig c1 = new CommentConfig(); // 处理文件类型 c1.setFileTypeSuffix("xml,html"); // 过滤掉"<!-- -->"的注释 Set<CommentType> commentFilters1 = c1.getCommentTypes(); commentFilters1.add(new CommentType("<!--", "-->")); confs.add(c1); CommentConfig c2 = new CommentConfig(); // 处理文件类型 c2.setFileTypeSuffix("properties,sh"); // 过滤掉"#"的注释 Set<CommentType> commentFilters2 = c2.getCommentTypes(); CommentType e = new CommentType("#"); e.setException("#!"); commentFilters2.add(e); confs.add(c2); CommentFilter.clearComments(prjPath, destPrjPath, confs); System.out.println("耗时:" + (System.currentTimeMillis() - startTime) * 0.001 + "s"); }}
源码:https://github.com/Slive/org.slive.project.style
http://download.csdn.net/detail/lipslive/9602161
0 0
- 个人项目-过滤代码工程文件注释
- COPY文件,过滤注释.
- Atom过滤工程文件
- maven项目文件过滤
- 代码统计——过滤注释空行
- 个人项目代码存放
- Mac下SVN提交xcode工程代码需要过滤的文件
- 关于代码注释我的个人看法
- 注释过滤
- VB工程--百例48--文件过滤
- androdstudio工程提交svn过滤文件列表
- Android Studio 工程版本控制过滤文件
- .gitignore-过滤工程中所有无用文件
- Maven工程使用Git提交过滤文件
- 预处理过滤代码中的不需要的代码并且保留注释
- 过滤驱动加密文件(代码)
- svn提交代码过滤文件
- 项目工程文件分类
- 计算机的数字计算
- 欢迎使用CSDN-markdown编辑器
- Effective C++笔记(2)—使用const
- mac Finder 快捷键
- IIS中 SSL服务器证书配置以及私钥找回小结
- 个人项目-过滤代码工程文件注释
- 基于sublime搭建python开发环境(windows)
- [知了开发]“知了”优化 - WebMagic 调优
- 最详细的SVN安装使用手册-Centos6.4系统运行通过
- KCon黑客大会十大神器webzmap的安装与使用
- poj1979【基础bfs/dfs】
- Python 之 WSGI
- UVA - 10557 XYZZY
- Python-产生随机数