日期:2014-05-20 浏览次数:20761 次
public static void main(String[] args) throws IOException { Reader reader = new InputStreamReader(FilterJSComment.class.getResourceAsStream("/server.xml"),"utf-8"); char buffer[] = new char[1000]; int i=0; StringBuilder sb = new StringBuilder(); while((i=reader.read(buffer))!=-1){ sb.append(buffer,0,i); } reader.close(); String str = sb.toString(); System.out.println(str); String h = str.replaceAll("<!--(?>\\n\\r|\\r|\\n|.)*?-->", ""); System.out.println(h); }