Here you can find the source of openStream(String urlStr)
public static InputStream openStream(String urlStr)
//package com.java2s; /*/*from w ww. jav a 2s.co m*/ * Xapp (pronounced Zap!), A automatic gui tool for Java. * Copyright (C) 2009 David Webber. All Rights Reserved. * * The contents of this file may be used under the terms of the GNU Lesser * General Public License Version 2.1 or later. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. */ import java.io.*; import java.net.URL; import java.net.MalformedURLException; public class Main { public static InputStream openStream(String urlStr) { URL url; try { url = new URL(urlStr); } catch (MalformedURLException e) { throw new RuntimeException(e); } InputStream in; try { in = url.openStream(); } catch (IOException e) { throw new RuntimeException(e); } return in; } }