Chapter 5. Network Streams
From its first days, Java has had the network in mind, more so than
any other common programming language. Java is the first programming
language to provide as much support for network I/O as it does for
file I/O, perhaps even more—Java’s
classes are all fertile sources of streams. The exact type of the
stream used by a network connection is typically hidden inside the
sun classes. Thus, network I/O relies
primarily on the basic
OutputStream methods, which you can wrap with any
higher-level stream that suits your needs: buffering, cryptography,
compression, or whatever your application requires.
represents a Uniform Resource Locator like
http://metalab.unc.edu/javafaq/. Each URL
unambiguously identifies the location of a resource on the Internet.
URL class has four
All are declared to throw
public URL(String u) throws MalformedURLException public URL(String protocol, String host, String file) throws MalformedURLException public URL(String protocol, String host, int port, String file) throws MalformedURLException public URL(URL context, String u) throws MalformedURLException
is thrown if the constructor’s arguments do not specify a valid URL. Often this means a particular Java implementation does not have the right protocol handler installed. Thus, given a complete ...