色综合图-色综合图片-色综合图片二区150p-色综合图区-玖玖国产精品视频-玖玖香蕉视频

您的位置:首頁技術(shù)文章
文章詳情頁

刪除java的注釋信息

瀏覽:122日期:2024-06-11 17:57:05
內(nèi)容: import java.util.regex.*;import java.io.*;import util9.*;//某些java文件注釋信息過多從而影響了可讀性。利用此類可解決這個(gè)問題。//使用方法略。public class DelNoteInJavaFile { static BufferedReader br; static BufferedWriter bw; static String suffix='.noNote.java'; public DelNoteInJavaFile() { String message='input file name:'; String ret=Read9.stringFromControl(message); if(inJava(new File(ret)))System.out.println('successed'); else System.out.println('failed'); } public DelNoteInJavaFile(String f) { if(inJava(new File(f)))System.out.println('successed'); else System.out.println('failed'); } public DelNoteInJavaFile(File f) { if(inJava(f)) System.out.println('successed'); else System.out.println('failed'); } public static boolean check(File f) { if (!f.exists()) { System.err.println('wrong1.file not exists'); return false; } if (!f.isFile()) { System.err.println('wrong2.abstract file is not a file'); return false; } return true; } public static boolean inJava(File f) { if(check(f)==false ) return false ; File ff = new File(f.getName() + suffix); if (ff.exists()) { System.out.println('wrong3'); return false; } String s, ss; try { ff.createNewFile(); br = new BufferedReader(new FileReader(f)); bw = new BufferedWriter(new FileWriter(ff)); //the slash is char '/',the star is char '*'. Pattern slash_star_start = Pattern.compile('/*.*');//just like:/*.... Pattern star_slash = Pattern.compile('^.**/'); Pattern slash_star_both = Pattern.compile('/*.**/'); Pattern slash2 = Pattern.compile('s{0,}//'); // Pattern star = Pattern.compile('s{0,}*'); Matcher mat; int i = 0; boolean note = false; while ( (s = br.readLine()) != null) { //deal with such string:... /*...*/.... if(s.trim().length()==0) continue; s = s.replaceAll(slash_star_both.pattern(), ''); //deal with:....//.... mat = slash2.matcher(s); if (mat.find()&¬e==false) { System.out.println('s1='+s); s = s.substring(0, mat.start()); if (s.trim().length() == 0)continue; bw.write(s); bw.newLine(); continue; } //deal with:...*/... mat = star_slash.matcher(s); if (mat.find()) { note = false; System.out.println('s2='+s); s = s.substring(mat.end()); if (s.trim().length() == 0) { continue; } } if (note == true) { continue; } //deal with:..../*.... mat = slash_star_start.matcher(s); if (mat.find()) { note = true; System.out.println('s=' + s); s = s.substring(0, mat.start()); System.out.println('s1=' + s + ',mat.start()=' + mat.start()); if (s.trim().length() == 0) { continue; } } bw.write(s); bw.newLine(); } br.close(); bw.close(); /* if (f.renameTo(new File(ff.getName() + '.bak'))) { System.out.println('backup file is:' + ff.getName() + '.bak'); if( ff.renameTo(f)) System.out.println('output file is:'+f.getName()); else {System.out.println('wrong53');return false;} } else { System.out.println('wrong55'); return false; } */ } catch (IOException e) { e.getMessage(); return false; } return true; } public static boolean inJava(String s) { return inJava(new File(s)); } public static void main(String a[]) {if(a.length==0)new DelNote9(); else new DelNoteInJavaFile(a[0]); }} Java, java, J2SE, j2se, J2EE, j2ee, J2ME, j2me, ejb, ejb3, JBOSS, jboss, spring, hibernate, jdo, struts, webwork, ajax, AJAX, mysql, MySQL, Oracle, Weblogic, Websphere, scjp, scjd
標(biāo)簽: Java
相關(guān)文章:
主站蜘蛛池模板: 日本乱理伦片在线观看网址 | 97视频在线免费观看 | 久久男人的天堂色偷偷 | 久草3| 成年女人免费视频播放成年m | 国产成人久久精品推最新 | 日韩视频在线观看一区二区 | 在线欧美一区 | 国产高清免费不卡观看 | www.三级| 亚洲国产综合久久精品 | a毛片免费观看完整 | 国产免费一区不卡在线 | 99这里只有精品66视频 | 国产在线观看免费人成小说 | 在线毛片网站 | 波多野结衣一区二区在线 | 成年人黄视频在线观看 | 黄网在线观看免费网站台湾swag | 222aaa免费国产在线观看 | 日本特黄特色大片免费看 | 男女无遮挡拍拍拍免费1000 | 亚洲国产第一区二区三区 | 亚洲精品成人一区二区aⅴ 亚洲精品成人一区二区www | 三级毛片在线播放 | 涩里番资源网站在线观看 | 国产一区二区免费播放 | 一级爱| 日韩黄色免费观看 | 亚洲欧美日本韩国综合在线观看 | 欧美成人精品一级高清片 | 精品视频一区在线观看 | 国产视频三区 | 午夜毛片视频高清不卡免费 | 在线免费看a | 国产高清在线精品一区在线 | 亚洲一区三区 | 九九视频在线免费观看 | 性欧美精品孕妇 | 久久免费精品国产72精品剧情 | 亚洲精品国产免费 |