Here you can find the source of readURL(String url)
public static String readURL(String url) throws MalformedURLException, IOException
//package com.java2s; // for Our Notice and the LICENSE file for the GNU Lesser General Public import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; public class Main { private final static String EOL = "\n"; /**/*from w w w. jav a 2 s . c o m*/ * Read data from a properly formatted URL and return it as a string. * This method may throw a <code>MalformedURLException</code> if the * URL is improperly formatted or an <code>IOException</code> if there * is a problem reading the URL data. */ public static String readURL(String url) throws MalformedURLException, IOException { InputStream is = new URL(url).openStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(is)); StringBuffer buffer = new StringBuffer(); String line = null; while ((line = reader.readLine()) != null) { buffer.append(line); buffer.append(EOL); } is.close(); return buffer.toString(); } }