Here you can find the source of readURL(URL url)
public static String readURL(URL url)
//package com.java2s; //License from project: Open Source License import java.io.*; import java.net.*; public class Main { public static String readURL(URL url) { try {//from w w w. ja va2 s . c o m InputStreamReader in = new InputStreamReader(url.openStream()); char[] buffer = new char[1024]; int l = 0; StringBuilder sb = new StringBuilder(); while ((l = in.read(buffer, 0, buffer.length)) > -1) { sb.append(buffer, 0, l); } in.close(); return new String(sb); } catch (Exception e) { e.printStackTrace(); } return null; } }