Using URL to get to remote items:
1) Create a URL object representing file
2) Create an URLConnection object that can
load this URL and make a connection to the site hosting it.
3) Using getInputStream() method of the URLConnection
object, create an InputStreamReader that can read from this
URL.
4) If you wish create a different kind of reader,
e.g. BufferedReader, as we did before with File I/O to more efficiently
read the data as you wish.
Examples connecting with URLs
|