urldecodefilter.java

来自「java编写的OCR软件」· Java 代码 · 共 67 行

JAVA
67
字号
package de.spieleck.app.jacson.filter;

import de.spieleck.config.ConfigNode;
import de.spieleck.config.ConfigVerify.Acceptor;

import de.spieleck.net.URLTools;

import de.spieleck.app.jacson.JacsonException;
import de.spieleck.app.jacson.JacsonConfigException;
import de.spieleck.app.jacson.JacsonRegistry;
import de.spieleck.app.jacson.util.ConfigUtil;

/**
 * Filter to URLDecode a chunk.
 * <p>
 * XXX This is a good idea in demo quality, we only decode
 * 2 characters in a very inefficient way. We do not (yet) 
 * want to rely on JDK URLDecode.
 * </p>
 * @author fsn
 */
public class URLDecodeFilter
    extends FilterBase
    implements Acceptor
{
    public void init(ConfigNode config, JacsonRegistry registry)
        throws JacsonConfigException
    {
        ConfigUtil.verify(config, this);
    }

    public boolean accept(ConfigNode node)
    {
        return false;
    }

    protected StringBuffer sb = new StringBuffer(200);

    public void putChunk(String chunk)
        throws JacsonException
    {
        if ( chunk != null )
        {
            chunk = URLTools.decode(chunk);
        }
        drain.putChunk(chunk);
    }
}
//
//    Jacson - Text Filtering with Java.
//    Copyright (C) 2002 Frank S. Nestel (nestefan -at- users.sourceforge.net)
//
//    This library is free software; you can redistribute it and/or
//    modify it under the terms of the GNU Lesser General Public
//    License as published by the Free Software Foundation; either
//    version 2.1 of the License, or (at your option) any later version.
//
//    This library is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//    Lesser General Public License for more details.
//
//    You should have received a copy of the GNU Lesser General Public
//    License along with this library; if not, write to the Free Software
//    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?