Java Utililty Methods URL Open

List of utility methods to do URL Open

Description

The list of methods to do URL Open are organized into topic(s).

Method

BufferedReaderopenReader(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"));
BufferedInputStreamopenStream(String aURL)
open Stream
URL myURL = new URL(aURL);
HttpURLConnection c = (HttpURLConnection) myURL.openConnection();
c.setConnectTimeout(500);
return new BufferedInputStream(c.getInputStream());
InputStreamopenURL(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;
...
HttpURLConnectionopenURLConnection(final URL couchdbURL)
open URL Connection
try {
    return (HttpURLConnection) couchdbURL.openConnection();
} catch (IOException ioe) {
    throw new RuntimeException(ioe);