Here you can find the source of readURL(final String textURL)
public static String readURL(final String textURL)
//package com.java2s; /**//from w w w.j a v a 2 s . c o m * Copyright (C) 2011-2013 Barchart, Inc. <http://www.barchart.com/> * * All rights reserved. Licensed under the OSI BSD License. * * http://www.opensource.org/licenses/bsd-license.php */ import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; public class Main { /** * Read string from URL. */ public static String readURL(final String textURL) { final StringBuilder text = new StringBuilder(128); try { final URL url = new URL(textURL); final HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setConnectTimeout(2 * 1000); connection.setRequestMethod("GET"); connection.setRequestProperty("User-Agent", "config-reader"); connection.connect(); final InputStream input = connection.getInputStream(); final InputStreamReader reader = new InputStreamReader(input); final BufferedReader buffered = new BufferedReader(reader); String line; while ((line = buffered.readLine()) != null) { text.append(line); } buffered.close(); } catch (final Exception e) { text.append(e.getMessage()); } return text.toString(); } }