brokenlinkfilter.java
来自「java编写的OCR软件」· Java 代码 · 共 46 行
JAVA
46 行
/* * BrokenLinkFilter.java * * Created on 4. April 2004, 17:21 */package de.spieleck.app.jacson.filter;import de.spieleck.app.jacson.JacsonException;import java.io.IOException;import java.net.URL;import java.io.InputStream;/** * This filter checks if a given chunk, treated as URL works, i.e. the given * ressource is reachable * <br> * @author Patrick Carl * @since 0.89 * @version $Id: BrokenLinkFilter.java 13 2005-09-28 06:02:56Z pcs $ */public class BrokenLinkFilter extends ConstFilter{ /** * filters the given chunk out if <ul> * <li>the given chunk represents a working URL and this filter is set to * inverse</li> * <li>the given chunk represents no working URL and this filter is not * set to inverse</li> * </ul> * */ public void putChunk(String chunk) throws JacsonException { try{ URL url = new URL(chunk); InputStream is = url.openStream(); if(inverse) drain.putChunk(chunk); is.close(); } catch (IOException broken){ if(!inverse) drain.putChunk(chunk); } }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?