MyFilter.java
上传用户:yuyunping
上传日期:2013-03-21
资源大小:1844k
文件大小:1k
源码类别:

Java书籍

开发平台:

Java

  1. package net.acai.filter;
  2. import net.acai.filter.*;
  3. /**
  4.  * Title:        清清网络
  5.  * Description:
  6.  * Copyright:    Copyright (c) 2002
  7.  * Company:      www.SuperSpace.com
  8.  * @author:       SuperSpace
  9.  * @version 1.0
  10.  */
  11. public class MyFilter {
  12.   String s="";
  13.   String outString="";
  14.   public MyFilter(String s) {
  15.     this.s=s;
  16.     outString=s;
  17.   }
  18.   public String getFilterString(){
  19.     return convertString();
  20.   }
  21.   public String convertString(){
  22.     String [] filterClass={"IMGFilter","URLFilter","EmailFilter","FlashFilter","ObjectFilter",
  23.             "CodeFilter","ColorFilter","CSSFilter","TextStyleFilter","FontFilter","AutoFilter"};
  24.     UBBFilter m;
  25.     for(int i=0;i<filterClass.length;i++){
  26.         try{
  27.             m=(UBBFilter)Class.forName("net.acai.filter."+filterClass[i]).newInstance();
  28.             m.setInputString(outString);
  29.             outString=m.getFilterString();
  30.         }
  31.         catch(Exception e){
  32.           e.printStackTrace();
  33.           }
  34.     }
  35.     return outString;
  36.   }
  37.   public static void main(String args[]){
  38.     String s="[color=1234][align=right]asdfasdf[/align][/color][align=right]<font color=#000066>[此贴子已经被asdf于2002-05-30 17:43:01编辑过]</font>[/align]";
  39.     MyFilter myFilter=new MyFilter(s);
  40.     System.out.println(myFilter.getFilterString());
  41.   }
  42. }