Working with URLs in Java
So far, this chapter has covered fairly low-level programming for programs that use networking. Although you can send any kind of data across a socket, sockets are not the best way to access a URL (Uniform Resource Locator) on the World Wide Web. This section shows how to use URLs in your Java program. You can read from a URL or check a URL for validity even if you are not running a program on the Web. A URL provides a unique domain name or address to access a remote system, using a Web browser or other program that can access the Web. The classes to support accessing URLs are in java.net, as are the other networking classes shown so far. The class java.net.URL provides a class that represents a URL on the Web. This ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access