Code example for URL

Methods: openStream

			throws IOException { 
		if (uri.getScheme().equals("content"))
			return context.getContentResolver().openInputStream(uri);
		else if (uri.getScheme().equals("file")) {
			URL url = new URL(uri.toString());
			return url.openStream();
		} else { 
			HttpClient httpclient = new DefaultHttpClient();
			HttpGet httpget = new HttpGet(uri.toString());
			HttpResponse response = httpclient.execute(httpget);
			HttpEntity entity = response.getEntity();
			if (entity != null)
				return entity.getContent();
				throw new IOException("No HTTP response");
			// Use the regular java stuff 
			// URL url = new URL(uri.toString()); 
Experience pair programming with AI  Get Codota for Java