Here you can find the source of getHttpGetContent(String strUrl, String charSet)
public static String getHttpGetContent(String strUrl, String charSet) throws Exception
//package com.java2s; //License from project: Open Source License import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.URL; import java.net.URLConnection; public class Main { public static String getHttpGetContent(String strUrl) throws Exception { return getHttpGetContent(strUrl, "UTF-8"); }// ww w. ja va2s. c o m public static String getHttpGetContent(String strUrl, String charSet) throws Exception { URL url = new URL(strUrl); URLConnection conn = url.openConnection(); BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream(), charSet)); StringBuffer sb = new StringBuffer(); String inputLine; while ((inputLine = in.readLine()) != null) { sb.append(inputLine).append(System.lineSeparator()); } return sb.toString(); } }