List of utility methods to do URL to InputStream
InputStream | getInputStreamForURL(URL url) get Input Stream For URL JarURLConnection conn = (JarURLConnection) url.openConnection();
return conn.getInputStream();
|
InputStream | getInputStreamForURL(URL url) get Input Stream For URL try { URLConnection connection = getConnection(url); return connection.getInputStream(); } catch (MalformedURLException e) { throw new IllegalArgumentException(e); |
InputStream | getInputStreamForURL(URL url) Get an InputStream from the zip file capable of reading from JarURLConnection conn = (JarURLConnection) url.openConnection();
return conn.getInputStream();
|
InputStream | getInputStreamFromURL(String theFilePath) get Input Stream From URL try { URL myUrl = new URL(theFilePath); InputStream myInputStream = myUrl.openStream(); return myInputStream; } catch (Exception ex) { System.out.println("### ERROR @ Util.getInputStreamFromURL / " + ex); return null; |
InputStreamReader | getInputStreamReader(URL url) get Input Stream Reader return new InputStreamReader(getInputStream(url)); |
byte[] | getUrlContents(String url) get Url Contents URL u = new URL(url); URLConnection uc = u.openConnection(); return toByteArray(uc.getInputStream()); |
String | getUrlContents(String urlString) get Url Contents URL url = new URL(urlString); if (url == null) return null; BufferedReader in = null; try { in = new BufferedReader(new InputStreamReader(url.openStream())); StringBuilder urlContents = new StringBuilder(); String inputLine; ... |
List | getUrlContents(String urlString) get Url Contents List<String> contents = new ArrayList<String>(); InputStream is = null; BufferedReader br = null; String line; URL url = null; try { url = new URL(urlString); is = url.openStream(); ... |
String | getUrlContents(URL url) get Url Contents BufferedReader bReader = null; String contents = null; try { StringBuilder buf = new StringBuilder(); bReader = new BufferedReader(new InputStreamReader(url.openStream())); String inputLine; while ((inputLine = bReader.readLine()) != null) { buf.append(inputLine); ... |
InputStream | openFileOrURL(String fileNameOrUrl) open File Or URL try { URL url = new URL(fileNameOrUrl); return url.openStream(); } catch (MalformedURLException mfe) { InputStream str = new FileInputStream(fileNameOrUrl); return str; |