List of utility methods to do URL to InputStream
InputStream | getInputStream(String url, int timeout) Attempts to obtain an InputStream from the provided url. final InputStream[] result = new InputStream[1]; try { final URLConnection connection = new URL(url).openConnection(); final Thread streamOpener = new Thread() { public void run() { try { result[0] = connection.getInputStream(); } catch (IOException e) { ... |
InputStream | getInputStream(URL sourceURL) get Input Stream InputStream is = null; try { is = sourceURL.openStream(); } catch (Exception e) { return is; |
InputStream | getInputStream(URL url) get Input Stream if ("file".equals(url.getProtocol())) { String path = url.getFile().replace('/', File.separatorChar); path = ParseUtil.decode(path); return new FileInputStream(path); } else { return url.openStream(); |
InputStream | getInputStream(URL url) get Input Stream URLConnection conn = url.openConnection();
conn.connect();
return conn.getInputStream();
|
InputStream | getInputStream(URL url) Returns an input stream for the given URL. if (url.getProtocol().equals("file")) { return new FileInputStream(url.getFile()); } else { return url.openStream(); |
InputStream | getInputStream(URL url) get Input Stream if (url == null) return null; try { return url.openStream(); } catch (FileNotFoundException e) { return null; |
InputStream | getInputStream(URL urlFile) Get the input stream from a URL. InputStream is = null; try { is = new BufferedInputStream(urlFile.openStream()); catch (ConnectException e) { throw new java.net.ConnectException("Could not connect to URL: " + urlFile.toExternalForm() + "."); return is; ... |
InputStream | getInputStream(URLConnection c) get Input Stream InputStream is = c.getInputStream(); String enc = c.getContentEncoding(); if ("gzip".equalsIgnoreCase(enc) || "x-gzip".equalsIgnoreCase(enc)) { is = new GZIPInputStream(is, TRANSFER_BUFFER); } else if ("deflate".equalsIgnoreCase(enc)) { is = new InflaterInputStream(is, new Inflater(), TRANSFER_BUFFER); return new BufferedInputStream(is); ... |
InputStream | getInputStream(URLConnection connection) gets the input stream from an url connection InputStream in = connection.getInputStream(); String encoding = connection.getContentEncoding(); if (encoding != null) { if (encoding.equals("deflate")) return new InflaterInputStream(in); else if (encoding.equals("gzip")) return new GZIPInputStream(in); else ... |
InputStream | getInputStream(URLConnection paramURLConnection) get Input Stream InputStream stream = paramURLConnection.getInputStream(); String encoding = paramURLConnection.getContentEncoding(); if (encoding != null) { encoding = encoding.toLowerCase(); if (encoding.contains("gzip")) { stream = new GZIPInputStream(stream); } else if (encoding.contains("deflate")) { stream = new InflaterInputStream(stream); ... |