// Decompiled Using: FrontEnd Plus v2.03 and the JAD Engine
// Available From: http://www.reflections.ath.cx
// Decompiler options: packimports(3) 
// Source File Name:   HTMLFilter.java

package filter;

import java.io.PrintStream;

public class HTMLFilter
{

    public HTMLFilter()
    {
        source = "";
    }

    public void run()
    {
        source = replaceHTML(source);
    }

    private String replaceHTML(String s)
    {
        StringBuffer stringbuffer = new StringBuffer();
        for(int i = 0; i < s.length(); i++)
        {
            char c = s.charAt(i);
            switch(c)
            {
            case 39: // '\''
                stringbuffer.append("&#039;");
                break;

            case 34: // '"'
                stringbuffer.append("&quot;");
                break;

            case 60: // '<'
                stringbuffer.append("&lt;");
                break;

            case 62: // '>'
                stringbuffer.append("&gt;");
                break;

            case 38: // '&'
                stringbuffer.append("&amp;");
                break;

            case 32: // ' '
                stringbuffer.append("&nbsp;");
                break;

            case 10: // '\n'
                stringbuffer.append("<br>");
                break;

            default:
                stringbuffer.append(c);
                break;
            }
        }

        return stringbuffer.toString();
    }

    public void setSource(String s)
    {
        source = s;
    }

    public String getResult()
    {
        return source;
    }

    public static void main(String args[])
    {
        HTMLFilter htmlfilter = new HTMLFilter();
        String s = "abc<>abc";
        htmlfilter.setSource(s);
        htmlfilter.run();
        System.out.println(htmlfilter.source);
        System.out.println(htmlfilter.getResult());
    }

    public String source;
}
