List of utility methods to do URL to InputStream
InputStream | openFileOrURL(String name) open File Or URL if (name.startsWith("resource:")) { URL url = Thread.currentThread().getContextClassLoader().getResource(name.substring(9)); if (url == null) throw new FileNotFoundException(name); return url.openStream(); if (name.indexOf(':') < 2) return new FileInputStream(name); ... |
InputStream | openInputStream(URL url) open Input Stream try { return url.openStream(); } catch (IOException e) { System.out.println("#URL: " + url); System.out.println(e.toString()); throw e; |
InputStream | openStream(String urlStr) open Stream URL url; try { url = new URL(urlStr); } catch (MalformedURLException e) { throw new RuntimeException(e); InputStream in; try { ... |
InputStream | openStream(URL url) open Stream return openStream(url, URL_TIMEOUT);
|
InputStream | openStream(URL url) open Stream File file = toFile(url); if (file != null) { return new FileInputStream(file); URLConnection connection = url.openConnection(); if (connection instanceof JarURLConnection) { connection.setUseCaches(false); InputStream is = connection.getInputStream(); return is; |
InputStream | openStream(URL url) open Stream try { return url.openStream(); } catch (IOException e) { throw new UncheckedIOException(e); |
InputStream | openStream(URL url) open Stream try { URLConnection connection = url.openConnection(); connection.setUseCaches(false); return connection.getInputStream(); } catch (IOException e) { String msg = "Failed to open the stream: url=" + url; throw new IllegalStateException(msg, e); |
InputStream | openStream(URL url) open Stream URLConnection connection = url.openConnection(); if (connection instanceof JarURLConnection) { connection.setUseCaches(false); InputStream is = connection.getInputStream(); return is; |
InputStream | openStream(URL url) Open a stream for the given URL with the CONNECT_TIMEOUT and READ_TIMEOUT. URLConnection conn = url.openConnection();
conn.setConnectTimeout(CONNECT_TIMEOUT);
conn.setReadTimeout(READ_TIMEOUT);
return conn.getInputStream();
|
InputStream | openStream(URL url) convenience method, directly returns a prepared stream return getInputStream(openConnection(url));
|