List of utility methods to do URLConnection Create
InputStream | openURL(String url) This is for opening URLs only provided by the programmer. URL urlObject; InputStream res = null; try { urlObject = new URL(url); URLConnection conn = urlObject.openConnection(); res = conn.getInputStream(); } catch (MalformedURLException e) { e.printStackTrace(); ... |
InputStream | openURLStream(final URI uri) open URL Stream final URL url = uri.toURL(); URLConnection connection = url.openConnection(); int timeout = 20000; connection.setReadTimeout(timeout); return connection.getInputStream(); |