Java URLConnection Create openURLStream(final URI uri)

Here you can find the source of openURLStream(final URI uri)

Description

open URL Stream

License

Open Source License

Declaration

private static InputStream openURLStream(final URI uri) throws IOException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.IOException;
import java.io.InputStream;

import java.net.URI;
import java.net.URL;
import java.net.URLConnection;

public class Main {
    private static InputStream openURLStream(final URI uri) throws IOException {
        final URL url = uri.toURL();
        URLConnection connection = url.openConnection();
        int timeout = 20000;
        connection.setReadTimeout(timeout);
        return connection.getInputStream();
    }//  ww  w.  j  a  v a 2s .  c  o  m
}

Related

  1. openConnection(URL url)
  2. openConnectionForceNoProxy(URL url)
  3. openConnectionTo(URL descriptor)
  4. openInputStream(URL url)
  5. openURL(String url)