久久福利_99r_国产日韩在线视频_直接看av的网站_中文欧美日韩_久久一

您的位置:首頁技術文章
文章詳情頁

刪除java的注釋信息

瀏覽:135日期:2024-06-11 17:57:05
內容: import java.util.regex.*;import java.io.*;import util9.*;//某些java文件注釋信息過多從而影響了可讀性。利用此類可解決這個問題。//使用方法略。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
標簽: Java
相關文章:
主站蜘蛛池模板: www久久精品 | 91精品区 | 中文字幕av网站 | 国产精品一区二区三区免费 | 人人干网站 | 在线免费看a | 天堂资源库| 91视频在线 | 久久99精品久久久久久园产越南 | 久久亚洲欧美日韩精品专区 | 国产伦精品一区二区三区四区视频 | 欧美中文在线 | www.成人 | 欧美日本国产 | 日本韩国欧美一区 | www.色综合 | jizzjizz亚洲中国少妇 | 欧美日韩在线不卡 | 欧美一区二区三 | 亚洲精品国产剧情久久9191 | 99久久99热这里只有精品 | 九色视频在线播放 | 精品免费视频 | 久久久久国产视频 | 日本激情网 | 一区二区在线电影 | 国产国拍亚洲精品av | 国产精品1页 | 久草视频在线播放 | 久久久久久网站 | 欧美男人天堂网 | 国产一区91| 成人午夜在线 | 国产福利电影一区 | 欧美日韩精品一区二区在线播放 | 午夜精品久久久久久久99黑人 | 欧洲另类二三四区 | 国产精品久久久久久一级毛片 | 精品成人免费一区二区在线播放 | 日本中文字幕一区 | 亚洲精品免费在线 |