List of utility methods to do URL Open
BufferedReader | openReader(String aUrl) convenience method for opening a buffered reader to an url, standard timeout is set to 500 milliseconds URL myURL = new URL(aUrl); HttpURLConnection c = (HttpURLConnection) myURL.openConnection(); c.setConnectTimeout(500); return new BufferedReader(new InputStreamReader(new BufferedInputStream(c.getInputStream()), "UTF-8")); |
BufferedInputStream | openStream(String aURL) open Stream URL myURL = new URL(aURL); HttpURLConnection c = (HttpURLConnection) myURL.openConnection(); c.setConnectTimeout(500); return new BufferedInputStream(c.getInputStream()); |
InputStream | openURL(URL source_url) Note1: it is the caller's responsibility to close the returned InputStream. if (false) { System.out.println("Util::openUrl( " + source_url + " )"); InputStream input_stream = null; URLConnection url_connection = source_url.openConnection(); url_connection.setUseCaches(true); if (url_connection instanceof HttpURLConnection) { HttpURLConnection http_conn = (HttpURLConnection) url_connection; ... |
HttpURLConnection | openURLConnection(final URL couchdbURL) open URL Connection try { return (HttpURLConnection) couchdbURL.openConnection(); } catch (IOException ioe) { throw new RuntimeException(ioe); |