Here you can find the source of openURL(String url)
public static InputStream openURL(String url)
//package com.java2s; //License from project: Open Source License import java.io.InputStream; import java.io.IOException; import java.net.URL; import java.net.URLConnection; import java.net.MalformedURLException; public class Main { /** This is for opening URLs only provided by the programmer. * URLs provided by the user should be checked for errors and the * user notified. Only use this if you have a single response to * any non-content situation on opening a URL *//*from w w w . ja v a 2 s. c o m*/ public static InputStream openURL(String url) { URL urlObject; InputStream res = null; try { urlObject = new URL(url); URLConnection conn = urlObject.openConnection(); res = conn.getInputStream(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return res; } }