specialsitelist.java
来自「是个java写的sipder,非常不错!能承受很大的压力,每天采集的数量在100」· Java 代码 · 共 55 行
JAVA
55 行
/**
*
*/
package cn.yicha.subject.spider.wapsite;
import java.io.*;
import cn.yicha.common.util.Logger;
/**
* @author zhangdi
*
*/
public class SpecialSiteList extends Logger {
protected static final String _SITE_SPLIT_CHAR = "\r\n\r\n|\n\n";
private static String _list = "";
public SpecialSiteList(String sfn) {
char[] buf = null;
try {
File f = new File(sfn);
FileReader fr = new FileReader(f);
buf = new char[(int) f.length()];
fr.read(buf);
} catch (FileNotFoundException fnfe) {
_logClass.error("config file not found");
} catch (IOException ioe) {
_logClass.error("config file read error");
} catch (Exception e) {
_logClass.error("config file unknown error");
}
if (buf != null) {
_list = new String(buf);
}
}
public String[] getSitesFromList() {
if (getList() == null || getList().length() == 0) {
return null;
}
return getList().split(_SITE_SPLIT_CHAR);
}
public static String getList() {
return _list;
}
public static void setList(String list) {
SpecialSiteList._list = list;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?