Opens an input stream to the given URL.

@param url
the URL to open the stream to.
@return
an input stream to access the URL.
@throws IOException
if an error occurs opening the stream.
425932
public static InputStream fromURL(URL url) throws IOException {
		if(url != null) {
			return url.openStream();
		}
		return null;
	}
1096043
protected URLConnection openConnection(URL url)
        throws IOException
    {
        URLConnection conn = url.openConnection();

        conn.setDoOutput(true);

        if (_basicAuth != null)
            conn.setRequestProperty("Authorization", _basicAuth);
        else if (_user != null && _password != null) {
            _basicAuth = "Basic " + base64(_user + ":" + _password);
            conn.setRequestProperty("Authorization", _basicAuth);
        }

        return conn;
    }
1335242
public static String read(URL url) throws IOException, NotFoundException {
        BufferedImage image = ImageIO.read(url);
        return read(image);
    }
975467
public JSONObject makeHttpRequest(String url) throws IOException {

        InputStream is = null;
        JSONObject jObj = null;
        String json = null;
        // Making HTTP request
        try {

            is = new URL(url).openStream();


        } catch (Exception ex) {
            Log.d("Networking", ex.getLocalizedMessage());
            throw new IOException("Error connecting");
        }

        try {
            BufferedReader reader = new BufferedReader(new InputStreamReader(
                is, "iso-8859-1"), 8);
            StringBuilder sb = new StringBuilder();
            String line = null;
            while ((line = reader.readLine()) != null) {
                sb.append(line + "\n");
            }
            json = sb.toString();
            reader.close();

        } catch (Exception e) {
            Log.e("Buffer Error", "Error converting result " + e.toString());
        } finally{
            try {
                is.close();
            }catch (Exception ex){}
        }

        // try parse the string to a JSON object
        try {
            jObj = new JSONObject(json);
        } catch (JSONException e) {
            Log.e("JSON Parser", "Error parsing data " + e.toString());
        }

        // return JSON String
        return jObj;

    }
1017394
@Override
    public InputStream getInputStream() throws IOException {
	if (barr == null) {
	    barr = IOUtil.toBytes(url.openStream());
	}
	return new ByteArrayInputStream(barr);
    }
72430
private InputStream downloadUrl(String myurl) throws IOException {
        InputStream is = null;
        // Only display the first 500 characters of the retrieved
        // web page content.
        try {
            URL url = new URL(myurl);
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
            conn.setReadTimeout(28000 /* milliseconds */);
            //set back to 15000, 10000
            conn.setConnectTimeout(30000 /* milliseconds */);
            conn.setRequestMethod("GET");
            conn.setDoInput(true);
            // Starts the query
            conn.connect();
            is = conn.getInputStream();
            return is;
        } finally {
            if (is != null) {
                is.close();
            }
        }
    }
6538
@Override
    @SuppressWarnings("unused")
    public URLConnection openConnection(URL url) throws IOException {
        try {
            return (URLConnection) _openConnection.invoke(getInstance(), new Object[] { url });
        } catch (Exception e) {
            FFDCFilter.processException(e, getClass().getName(), "openConnection", url);
            return null;
        }
    }
1005964
public URLConnection createURLConnection(URL url) throws IOException {
        URLConnection conn = url.openConnection();
		return conn;
	}
110895
public static InputStream getInputStreamFromHttp(String httpFileURL) throws IOException {

        URLConnection urlConnection = null;
        urlConnection = new URL(httpFileURL).openConnection();
        urlConnection.connect();
        return urlConnection.getInputStream();
    }
480411
public static Study readStudy(final URL url) throws IOException {
        checkNotNull(url);
        try (BufferedReader reader = Resources.asCharSource(url, Charsets.UTF_8).openBufferedStream()) {
            return readStudy(reader);
        }
    }
445119
public static InputStream getUrlPictureStream(String urlPath) throws IOException {
		URL url  = new URL(urlPath);
		return url.openConnection().getInputStream();
	}
149119
public static Properties getProperties(URL url) throws IOException
    {
        Properties properties = new Properties();

        InputStream inputStream = url.openStream();
        try
        {
            properties.load(inputStream);
        }
        finally
        {
            inputStream.close();
        }

        return properties;
    }
615686
public static byte[] readBytes(URL url) throws IOException {
        URLConnection conn = url.openConnection();
        try {
            return readBytes(conn);
        } finally {
            close(conn);
        }
    }
1263815
protected URLConnection openConnection(URL u) throws IOException {
		String up = u.toExternalForm();
		String path = u.getPath();
		if (path.startsWith("/")) {
			path = path.substring(1);
		}
		if (this.preload.containsKey(up)) {
			SoftReference ref = (SoftReference)this.preload.get(up);
			CGCCleaner cleaner = (CGCCleaner)ref.get();

			if (cleaner == null) {
				try {
					this.preload.remove(up);
				} catch (Exception ignore) {
				}
			} // end if
			else {
				byte array[] = (byte[]) cleaner.get();

				return new CByteArrayUrlConnection(u, array);
			} // end else
		} // end if
		URL file = new URL(
				new String(CBASE64Codec.decode(u.getHost()), "utf-8"));
		JarInputStream in = new JarInputStream(file.openStream());
		JarEntry entry = null;

		while ((entry = in.getNextJarEntry()) != null) {
			if (entry.getName().equals(path)) {
				break;
			} // end if
			else {
				URL newU = new URL("yahpjarloader://" + u.getHost() + "/"
						+ entry.getName());
				this.addClassPreload(newU.toExternalForm(), loadByteArray(in));
			} // end else if
		} // end while

		if (entry == null) {
			in.close();
			throw new IOException("Resource not found ! : " + path + " - "
					+ file.toExternalForm());
		} // end if
		else {
			byte array[] = loadByteArray(in);
			in.close();

			return new CByteArrayUrlConnection(u, array);
		} // end else
	}
20705
public static byte[] getBytes(URL url) throws IOException {
        final String path = url.getPath();
        final File file = new File(path);
        if (file.exists()) {
            return getFileBytes(file);
        }

        return null;
    }
1045609
public static String readString(URL url, String charset) throws IORuntimeException {
		if (url == null) {
			throw new NullPointerException("Empty url provided!");
		}

		InputStream in = null;
		try {
			in = url.openStream();
			return IoUtil.read(in, charset);
		} catch (IOException e) {
			throw new IORuntimeException(e);
		} finally {
			IoUtil.close(in);
		}
	}
196931
private HttpURLConnection openConnection(URL url) throws IOException {
        URLConnection urlConnection = url.openConnection();
        if (!(urlConnection instanceof HttpURLConnection)) {
            throw new IllegalStateException("Connection should be an HttpURLConnection");
        }
        return (HttpURLConnection) urlConnection;
    }