Here you can find the source of readURL(final URL fileURL)
public static String readURL(final URL fileURL) throws IOException
//package com.java2s; // The MIT License import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; import java.net.URL; public class Main { public static String readURL(final URL fileURL) throws IOException { return readAll(new InputStreamReader(fileURL.openStream())); }//from w w w . java 2s . c o m public static String readAll(final Reader reader) throws IOException { final StringBuffer buffer = new StringBuffer(); final BufferedReader in = new BufferedReader(reader); int ch; while ((ch = in.read()) > -1) { buffer.append((char) ch); } in.close(); return buffer.toString(); } }