Here you can find the source of downloadHtmlPage(String pageUrl)
static String downloadHtmlPage(String pageUrl)
//package com.java2s; import java.io.BufferedInputStream; import java.io.InputStream; import java.net.URL; import java.net.URLConnection; import org.apache.http.util.ByteArrayBuffer; public class Main { static String downloadHtmlPage(String pageUrl) { try {/*from w ww . j a va 2 s .c om*/ URL url = new URL(pageUrl); URLConnection uConn = url.openConnection(); uConn.setConnectTimeout(15000); uConn.setReadTimeout(15000); InputStream is = uConn.getInputStream(); BufferedInputStream bis = new BufferedInputStream(is); ByteArrayBuffer baf = new ByteArrayBuffer(65536); int current; while ((current = bis.read()) != -1) baf.append((byte) current); return new String(baf.toByteArray(), "Cp1251"); } catch (Exception e) { return null; } } }