Here you can find the source of loadFromURL(URL url)
public static String loadFromURL(URL url)
//package com.java2s; import java.io.IOException; import java.io.InputStreamReader; import java.net.URL; public class Main { public static String loadFromURL(URL url) { if (url == null) { return null; }//from w w w. j a v a 2 s . co m try { InputStreamReader reader = new InputStreamReader( url.openStream()); StringBuilder sb = new StringBuilder(); char[] buf = new char[4096]; int read; while ((read = reader.read(buf)) > 0) { sb.append(buf, 0, read); } ; reader.close(); return sb.toString(); } catch (IOException e) { return null; } } }