Here you can find the source of readUrl(String urlString)
public static String readUrl(String urlString) throws Exception
//package com.java2s; //License from project: Open Source License import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.URL; public class Main { public static String readUrl(String urlString) throws Exception { URL url = new URL(urlString); try (BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()))) { StringBuilder buffer = new StringBuilder(); int read; char[] chars = new char[1024]; while ((read = reader.read(chars)) != -1) buffer.append(chars, 0, read); return buffer.toString(); }//from ww w.ja v a 2s .c om } }