Java URL Load loadURL(String urlDesc)

Here you can find the source of loadURL(String urlDesc)

Description

load URL

License

Creative Commons License

Declaration

public static StringBuffer loadURL(String urlDesc) 

Method Source Code

//package com.java2s;
/** /*  www.  j av a 2s  .  com*/
 * @author Dimitri Dean DARSEYNE (D3), 
 * Published by Short-Circuit under Creative Commons (CC) Licensing: 
 * Authorship/Paternity, NO Commercial Use, NO Derivative
 * Please check for more informations:
 * http://creativecommons.org/licenses/by-nc-nd/2.0/
 *
 * Auteur Dimitri Dean DARSEYNE (D3),
 * Publi? par Short-Circuit sous license Creative Commons (CC):
 * Paternit?, PAS d'Utilisation Commerciale, pas de D?riv?s/Modifications
 * Pour plus d'informations, se rendre sur:
 * http://creativecommons.org/licenses/by-nc-nd/2.0/fr/ 
 * 
 * @since Short-Circuit 1999
 */

import java.io.BufferedReader;

import java.io.InputStreamReader;
import java.net.URL;

public class Main {
    public static StringBuffer loadURL(String urlDesc) {
        StringBuffer buffer = new StringBuffer();

        try {
            URL urlContent = new URL(urlDesc);

            BufferedReader inBuf = new BufferedReader(new InputStreamReader(urlContent.openStream()));

            String strTemp;

            while ((strTemp = inBuf.readLine()) != null)
                buffer.append(strTemp + "\r\n");

            inBuf.close();

            //System.out.println("buf size " + buffer.length());
        } catch (Exception e) {
            System.out.println("loadURL" + urlDesc + " : " + e.toString());
        }

        return buffer;
    }
}

Related

  1. loadPropertiesFromFileOrURL(String propertiesFile)
  2. loadPropertiesFromURL(URL url)
  3. loadProps(URL url, Properties props)
  4. loadRemoteJSON(final URL source)
  5. loadText(URL url, boolean allowCache)
  6. loadURL(URL url)
  7. loadURL(URL url)
  8. loadUrlIntoByteArray(String urlString)
  9. loadUrlToList(URL iUrl)