Here you can find the source of readTextFileAtUrl(final URL url)
public static String readTextFileAtUrl(final URL url) throws IOException
//package com.java2s; //License from project: Apache License import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.URL; public class Main { public static String readTextFileAtUrl(final URL url) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream())); StringBuilder sb = new StringBuilder(); String inputLine;//w w w .ja va 2 s. c om while ((inputLine = br.readLine()) != null) { sb.append(inputLine + "\n"); } br.close(); return sb.toString(); } }