Here you can find the source of getUrlSource(String url)
private static String getUrlSource(String url) throws IOException
//package com.java2s; /*/* w w w .ja va2s. co m*/ * DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Version 2, December 2004 Copyright (C) 2004 Sam Hocevar <sam@hocevar.net> Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long as the name is changed. DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. You just DO WHAT THE FUCK YOU WANT TO. */ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.URL; import java.net.URLConnection; public class Main { private static String getUrlSource(String url) throws IOException { URL yahoo = new URL(url); URLConnection yc = yahoo.openConnection(); BufferedReader in = new BufferedReader(new InputStreamReader(yc.getInputStream(), "UTF-8")); String inputLine; StringBuilder a = new StringBuilder(); while ((inputLine = in.readLine()) != null) { a.append(inputLine + "\n"); } in.close(); return a.toString(); } }