Here you can find the source of readUrlToString(String urlString)
public static String readUrlToString(String urlString)
//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 readUrlToString(String urlString) { try {/*from w w w .j av a 2 s . c o m*/ URL website = new URL(urlString); URLConnection connection = website.openConnection(); BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); StringBuilder response = new StringBuilder(); String inputLine; while ((inputLine = in.readLine()) != null) response.append(inputLine); in.close(); return response.toString(); } catch (Exception e) { // Util.debug("Util.readUrlToString() parse error: "+urlString, "Util.readUrlToString()"); return null; } } }