Here you can find the source of readURL(String path)
public static String readURL(String path) throws MalformedURLException, IOException
//package com.java2s; //License from project: Open Source License import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; public class Main { public static String readURL(String path) throws MalformedURLException, IOException {/*from w ww . j av a 2 s . c o m*/ URL url = new URL(path); URLConnection con = url.openConnection(); Reader r = new InputStreamReader(con.getInputStream(), "UTF-8"); StringBuilder buf = new StringBuilder(); while (true) { int ch = r.read(); if (ch < 0) { break; } buf.append((char) ch); } return buf.toString(); } }