Here you can find the source of readFile(URL url)
public static String readFile(URL url) throws IOException
//package com.java2s; //License from project: Open Source License import com.google.common.io.ByteArrayDataOutput; import com.google.common.io.ByteStreams; import java.io.IOException; import java.io.InputStream; import java.net.URL; public class Main { public static String readFile(URL url) throws IOException { InputStream in = url.openStream(); ByteArrayDataOutput bout = ByteStreams.newDataOutput(); int b;/*from w w w. j a va 2 s .com*/ while ((b = in.read()) != -1) { bout.writeByte(b); } in.close(); return new String(bout.toByteArray()); } }