Here you can find the source of readFile(URL url)
public static String readFile(URL url)
//package com.java2s; //License from project: Open Source License import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.URL; public class Main { public static String readFile(URL url) { String result = ""; try {/*from w ww. ja v a2 s.co m*/ BufferedReader in = new BufferedReader(new InputStreamReader( url.openStream())); String inputLine = ""; while (inputLine != null) { result += inputLine + "\n"; inputLine = in.readLine(); } in.close(); } catch (IOException e) { throw new RuntimeException(e); } return result; } }