首先介绍每个类的功能: Dow nloadPage
java 的功能是下载此超链接的页面源代码
FunctionUtils
java 的功能是提供不同的静态方法,包括:页面链接正则表达式匹配,获取URL 链接的元素,判断是否创建文件,获取页面的Url 并将其转换为规范的Url,截取网页网页源文件的目标内容
HrefOfPage
java 的功能是获取页面源代码的超链接
UrlDataHanding
java 的功能是整合各个给类,实现 url 到获取数据到数据处理类
UrlQueue
java 的未访问 Url 队列
VisitedUrlQueue
java 已访问过的URL 队列
下面介绍一下每个类的源代码: Dow nloadPage
java 此类要用到 HttpClient 组件
package com
sreach
spider; 2
import java
IOException; 4
import org
apache
HttpEntity; 5
import org
apache
HttpResponse; 6
import org
apache
client
ClientProtocolException; 7
import org
apache
client
HttpClient; 8
import org
apache
client
methods
HttpGet; 9
import org
apache
client
DefaultHttpClient; 10
import org
apache
EntityUtils; 11
public class DownloadPage 13