得到返回网页个数

@param url
搜索的URL
@return
503938
static String search(String word) {
		word = word.replaceAll(" ", "+");
		String u;
		if(isUseBaidu)
			u = URL_BAIDU.replace("${wd}", word);
		else
			u = URL_GOOGLE.replace("${wd}", word);
		URL url;
		try {
			url = new URL(u);
		} catch (MalformedURLException e2) {
			// TODO Auto-generated catch block
			e2.printStackTrace();
			return null;
		}

		InputStream istream = null;
		while (true) {
			try {
				HttpURLConnection conn = (HttpURLConnection) url
						.openConnection();
				istream = conn.getInputStream();
				break;
			} catch (IOException e) {
				try {
					Thread.sleep(500);
				} catch (InterruptedException e1) {

				}
			}
		}

		StringBuilder sb = new StringBuilder();
		try {
			BufferedReader reader = new BufferedReader(new InputStreamReader(
					istream, "utf-8"));
			while (true) {
				String buf = reader.readLine();
				if (null == buf)
					break;
				sb.append(buf);				
			}
		} catch (IOException e) {

		}
		String htmlStr =sb.toString();
		//stripping script tags whether the tag contains "/n" or "/r" or not.   
		Matcher m_script = p_script.matcher(htmlStr);   
		htmlStr = m_script.replaceAll("");   

		//stripping style tags whether the tag contains "/n" or "/r" or not.   
		Matcher m_style = p_style.matcher(htmlStr);   
		htmlStr = m_style.replaceAll("");   

		//stripping html tags but continue to have the "/n" and "/r" in right place.   
		Matcher m_html = p_html.matcher(htmlStr);   
		htmlStr = m_html.replaceAll("");   
		
		htmlStr = htmlStr.replaceAll("(&amp;|&nbsp;|&#9654|&copy|◆|&#12288;|&gt;|&lt;)+", " ");
		if(isUseBaidu)
			htmlStr = htmlStr.replaceAll("(百度|_|搜索|\\.\\.\\.|-|2012|2011)", " ");
		htmlStr = htmlStr.replaceAll(String.valueOf(((char)12288))," ");
		htmlStr = htmlStr.replaceAll(" +", " ");
		
		return htmlStr;   

	}
1335242
public static String read(URL url) throws IOException, NotFoundException {
        BufferedImage image = ImageIO.read(url);
        return read(image);
    }
117700
private String downJson(String url) {
        // 构造HttpClient的实例
        HttpClient httpClient = new HttpClient();
        // 创建GET方法的实例
        GetMethod method = new GetMethod(url);
        try {
            // 执行GetMethod
            int statusCode = httpClient.executeMethod(method);
            LOGGER.info("响应代码：" + statusCode);
            if (statusCode != HttpStatus.SC_OK) {
                LOGGER.error("请求失败: " + method.getStatusLine());
            }
            // 读取内容
            String responseBody = new String(method.getResponseBody(), "utf-8");
            return responseBody;
        } catch (IOException e) {
            LOGGER.error("检查请求的路径：" + url, e);
        } finally {
            // 释放连接
            method.releaseConnection();
        }
        return "";
    }
823691
public static String urlToHost(String url) {
		String lcUrl = url.toLowerCase();
		if(lcUrl.startsWith(DNS_SCHEME)) {
			return lcUrl.substring(DNS_SCHEME.length());
		}
		for(String scheme : ALL_SCHEMES) {
			if(lcUrl.startsWith(scheme)) {
				int authorityIdx = scheme.length();

				Matcher m = 
					HOST_REGEX_SIMPLE.matcher(lcUrl.substring(authorityIdx));
				if(m.find()) {
					return m.group(1);
				}
			}
		}
		return url;
	}
1054866
private String getAssetAsString(String url)
   {
      InputStream is = null;
      try
      {
         is = assetManager.open(url);

         Reader r = new InputStreamReader(is, Charset.forName("UTF-8"));
         char[]         buffer = new char[4096];
         StringBuilder  sb = new StringBuilder();
         int            len = r.read(buffer);
         while (len > 0) {
            sb.append(buffer, 0, len);
            len = r.read(buffer);
         }
         return sb.toString();
      }
      catch (IOException e)
      {
         return null;
      }
      finally {
         try {
            if (is != null)
               is.close();
         } catch (IOException e) {
           // Do nothing
         }
      }
   }
556091
public static boolean isHttp(String url) {
		if (url.length() < 7 || !url.startsWith("http")) {
			return false;
		}
		int i = 4; // "http"
		if (url.charAt(i) == 's') {
			i++;
		}
		return url.startsWith("://", i);
	}
1295627
public List<URL> getURLS(String html, URL url) {

	List<URL> urls = new ArrayList<URL>();
	SourceCode cfml = new SourceCode(html, false, CFMLEngine.DIALECT_CFML);
	while (!cfml.isAfterLast()) {
	    if (cfml.forwardIfCurrent('<')) {
		for (int i = 0; i < tags.length; i++) {
		    if (cfml.forwardIfCurrent(tags[i].tag + " ")) {
			getSingleUrl(urls, cfml, tags[i], url);
		    }
		}
	    }
	    else {
		cfml.next();
	    }
	}
	return urls;
    }
1263797
public String apply(String url) {
    return format(
        getDefault(),
        "%s%s%s=%s",
        url,
        concatenationOperator(url),
        operation,
        argument);
  }
488551
public RFuture<String> get(String url) {
    return req(url).execute().map(GET_PAYLOAD);
  }
1219425
public String applyOnURL(String url) {
        if (StringUtils.isBlank(url)) {
            return url;
        }
        return StringUtils.substringBefore(url, "?") + toString();
    }
17635
public static String urlToString(URL url) {
        return Checker.isNull(url) ? "" : url.toString().replaceAll("file:" + (Checker.isWindows() ? "/?" : ""), "");
    }
1135296
public static UrlBuilder parse(URL url) {
        final UrlBuilder result = new UrlBuilder();

        if (url != null) {
            final String protocol = url.getProtocol();
            if (protocol != null && !protocol.isEmpty()) {
                result.withScheme(protocol);
            }

            final String host = url.getHost();
            if (host != null && !host.isEmpty()) {
                result.withHost(host);
            }

            final int port = url.getPort();
            if (port != -1) {
                result.withPort(port);
            }

            final String path = url.getPath();
            if (path != null && !path.isEmpty()) {
                result.withPath(path);
            }

            final String query = url.getQuery();
            if (query != null && !query.isEmpty()) {
                result.withQuery(query);
            }
        }

        return result;
    }
580516
public static String getUrl(final String url) throws Exception {
        return getUrl(new URL(url), null, null);
    }
147239
public boolean equalUrl(ReqUrl url) {
        return url.getMethod().equalsIgnoreCase(this.method) && url.getUrl().equalsIgnoreCase(this.url);
    }
54442
public static String getDecodedPath(URL url) {
		if (null == url) {
			return null;
		}

		String path = null;
		try {
			// URL对象的getPath方法对于包含中文或空格的问题
			path = URLUtil.toURI(url).getPath();
		} catch (UtilException e) {
			// ignore
		}
		return (null != path) ? path : url.getPath();
	}
1370966
private URL findJarForResource(URL url) {
        // 如果URL的文件部分本身是一个URL，那么该URL可能指向JAR
        try {
            long startTime = System.currentTimeMillis();
            while (true) {
                url = new URL(url.getFile());
                if (System.currentTimeMillis() - startTime > MAX_LIMIT) {
                    break;
                }
            }
        } catch (MalformedURLException expected) {
            // This will happen at some point and serves as a break in the loop
        }

        // Look for the .jar extension and chop off everything after that
        StringBuilder jarUrl = new StringBuilder(url.toExternalForm());
        int index = jarUrl.lastIndexOf(".jar");
        if (index >= 0) {
            jarUrl.setLength(index + 4);
        } else {
            return null;
        }

        // Try to open and test it
        try {
            URL testUrl = new URL(jarUrl.toString());
            if (this.isJar(testUrl)) {
                return testUrl;
            }

            // WebLogic fix: check if the URL's file exists in the filesystem.
            jarUrl.replace(0, jarUrl.length(), testUrl.getFile());
            File file = new File(jarUrl.toString());

            // File name might be URL-encoded
            if (!file.exists()) {
                file = new File(URLEncoder.encode(jarUrl.toString(), "UTF-8"));
            }

            if (file.exists()) {
                testUrl = file.toURI().toURL();
                if (isJar(testUrl)) {
                    return testUrl;
                }
            }
        } catch (MalformedURLException e) {
            log.warn("Invalid JAR URL: " + jarUrl);
        } catch (UnsupportedEncodingException e) {
            throw new ZealotException("Unsupported encoding?  UTF-8?  That's unpossible.");
        }

        return null;
    }
436095
protected String normalizeUrl(String url) {
    try {
      URL requestURL = new URL(url);
      StringBuilder normalized = new StringBuilder(requestURL.getProtocol().toLowerCase()).append("://").append(requestURL.getHost().toLowerCase());
      if ((requestURL.getPort() >= 0) && (requestURL.getPort() != requestURL.getDefaultPort())) {
        normalized.append(":").append(requestURL.getPort());
      }
      normalized.append(requestURL.getPath());
      return normalized.toString();
    }
    catch (MalformedURLException e) {
      throw new IllegalStateException("Illegal URL for calculating the OAuth signature.", e);
    }
  }