<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<!--NewPage-->
<html>
<head>
<!-- Generated by javadoc on Wed Jul 28 01:21:15 GMT 1999 -->
<title>
  Class java.net.URL
</title>
</head>
<body>
<a name="_top_"></a>
<pre>
<a href="packages.html">All Packages</a>  <a href="tree.html">Class Hierarchy</a>  <a href="Package-java.net.html">This Package</a>  <a href="java.net.SocketImpl.html#_top_">Previous</a>  <a href="java.net.URLConnection.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
<hr>
<h1>
  Class java.net.URL
</h1>
<pre>
<a href="java.lang.Object.html#_top_">java.lang.Object</a>
   |
   +----java.net.URL
</pre>
<hr>
<dl>
  <dt> public final class <b>URL</b>
  <dt> extends <a href="java.lang.Object.html#_top_">Object</a>
  <dt> implements <a href="java.io.Serializable.html#_top_">Serializable</a>
</dl>
Class <code>URL</code> represents a Uniform Resource 
 Locator, a pointer to a "resource" on the World 
 Wide Web. A resource can be something as simple as a file or a 
 directory, or it can be a reference to a more complicated object, 
 such as a query to a database or to a search engine. More 
 information on the types of URLs and their formats can be found at:
 <ul><code>
     http://www.ncsa.uiuc.edu/demoweb/url-primer.html
 </code></ul>
 <p>
 In general, a URL can be broken into several parts. The previous 
 example of a URL indicates that the protocol to use is 
 <code>http</code> (HyperText Transport Protocol) and that the 
 information resides on a host machine named 
 <code>www.ncsa.uiuc.edu</code>. The information on that host 
 machine is named <code>demoweb/url-primer.html</code>. The exact 
 meaning of this name on the host machine is both protocol 
 dependent and host dependent. The information normally resides in 
 a file, but it could be generated on the fly. This component of 
 the URL is called the <i>file</i> component, even though the 
 information is not necessarily in a file. 
 <p>
 A URL can optionally specify a "port", which is the 
 port number to which the TCP connection is made on the remote host 
 machine. If the port is not specified, the default port for 
 the protocol is used instead. For example, the default port for 
 <code>http</code> is <code>80</code>. An alternative port could be 
 specified as: 
 <ul><code>
     http://www.ncsa.uiuc.edu:8080/demoweb/url-primer.html
 </code></ul>
 <p>
 A URL may have appended to it an "anchor", also known 
 as a "ref" or a "reference". The anchor is 
 indicated by the sharp sign character "#" followed by 
 more characters. For example, 
 <ul><code>
     http://java.sun.com/index.html#chapter1
 </code></ul>
 <p>
 This anchor is not technically part of the URL. Rather, it 
 indicates that after the specified resource is retrieved, the 
 application is specifically interested in that part of the 
 document that has the tag <code>chapter1</code> attached to it. The 
 meaning of a tag is resource specific. 
 <p>
 An application can also specify a "relative URL", 
 which contains only enough information to reach the resource 
 relative to another URL. Relative URLs are frequently used within 
 HTML pages. For example, if the contents of the URL:
 <ul><code>
     http://java.sun.com/index.html
 </code></ul>
 contained within it the relative URL:
 <ul><code>
     FAQ.html
 </code></ul>
 it would be a shorthand for:
 <ul><code>
     http://java.sun.com/FAQ.html
 </code></ul>
 <p>
 The relative URL need not specify all the components of a URL. If 
 the protocol, host name, or port number is missing, the value is 
 inherited from the fully specified URL. The file component must be 
 specified. The optional anchor is not inherited.
<p>
<hr>
<a name="index"></a>
<h2>
  <img src="images/constructor-index.gif" width=275 height=38 alt="Constructor Index">
</h2>
<dl>
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#URL(java.lang.String)"><b>URL</b></a>(String)
  <dd>  Creates a <code>URL</code> object from the <code>String</code> 
 representation.
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#URL(java.lang.String, java.lang.String, int, java.lang.String)"><b>URL</b></a>(String, String, int, String)
  <dd> 
 Creates a <code>URL</code> object from the specified 
 <code>protocol</code>, <code>host</code>, <code>port</code> 
 number, and <code>file</code>.
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#URL(java.lang.String, java.lang.String, java.lang.String)"><b>URL</b></a>(String, String, String)
  <dd> 
 Creates an absolute URL from the specified <code>protocol</code> 
 name, <code>host</code> name, and <code>file</code> name.
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#URL(java.net.URL, java.lang.String)"><b>URL</b></a>(URL, String)
  <dd> 
 Creates a URL by parsing the specification <code>spec</code> 
 within a specified context.
</dl>
<h2>
  <img src="images/method-index.gif" width=207 height=38 alt="Method Index">
</h2>
<dl>
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#equals(java.lang.Object)"><b>equals</b></a>(Object)
  <dd>  Compares two URLs.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getContent()"><b>getContent</b></a>()
  <dd>  Returns the contents of this URL.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getFile()"><b>getFile</b></a>()
  <dd>  Returns the file name of this <code>URL</code>.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getHost()"><b>getHost</b></a>()
  <dd>  Returns the host name of this <code>URL</code>, if applicable.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getPort()"><b>getPort</b></a>()
  <dd>  Returns the port number of this <code>URL</code>.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getProtocol()"><b>getProtocol</b></a>()
  <dd>  Returns the protocol name this <code>URL</code>.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getRef()"><b>getRef</b></a>()
  <dd>  Returns the anchor (also known as the "reference") of this
 <code>URL</code>.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#hashCode()"><b>hashCode</b></a>()
  <dd> 
 Creates an integer suitable for hash table indexing.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#openConnection()"><b>openConnection</b></a>()
  <dd> 
 Returns a <code>URLConnection</code> object that represents a 
 connection to the remote object referred to by the <code>URL</code>.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#openStream()"><b>openStream</b></a>()
  <dd>  Opens a connection to this <code>URL</code> and returns an 
 <code>InputStream</code> for reading from that connection.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#sameFile(java.net.URL)"><b>sameFile</b></a>(URL)
  <dd>  Compares two URLs, excluding the "ref" fields.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#set(java.lang.String, java.lang.String, int, java.lang.String, java.lang.String)"><b>set</b></a>(String, String, int, String, String)
  <dd>  Sets the fields of the URL.
  <dt> <img src="images/green-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#setURLStreamHandlerFactory(java.net.URLStreamHandlerFactory)"><b>setURLStreamHandlerFactory</b></a>(URLStreamHandlerFactory)
  <dd>  Sets an application's <code>URLStreamHandlerFactory</code>.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#toExternalForm()"><b>toExternalForm</b></a>()
  <dd>  Constructs a string representation of this <code>URL</code>.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#toString()"><b>toString</b></a>()
  <dd>  Constructs a string representation of this <code>URL</code>.
</dl>
<a name="constructors"></a>
<h2>
  <img src="images/constructors.gif" width=231 height=38 alt="Constructors">
</h2>
<a name="URL"></a>
<a name="URL(java.lang.String, java.lang.String, int, java.lang.String)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>URL</b>
<pre>
 public URL(<a href="java.lang.String.html#_top_">String</a> protocol,
            <a href="java.lang.String.html#_top_">String</a> host,
            int port,
            <a href="java.lang.String.html#_top_">String</a> file) throws <a href="java.net.MalformedURLException.html#_top_">MalformedURLException</a>
</pre>
<dl>
  <dd> Creates a <code>URL</code> object from the specified 
 <code>protocol</code>, <code>host</code>, <code>port</code> 
 number, and <code>file</code>. Specifying a <code>port</code> 
 number of <code>-1</code> indicates that the URL should use 
 the default port for the protocol. 
 <p>
 If this is the first URL object being created with the specified 
 protocol, a <i>stream protocol handler</i> object, an instance of 
 class <code>URLStreamHandler</code>, is created for that protocol:
 <ol>
 <li>If the application has previously set up an instance of
     <code>URLStreamHandlerFactory</code> as the stream handler factory,
     then the <code>createURLStreamHandler</code> method of that instance
     is called with the protocol string as an argument to create the
     stream protocol handler.
 <li>If no <code>URLStreamHandlerFactory</code> has yet been set up,
     or if the factory's <code>createURLStreamHandler</code> method
     returns <code>null</code>, then the constructor finds the 
     value of the system property:
     <ul><code>
         java.handler.protol.pkgs
     </code></ul>
     If the value of that system property is not <code>null</code>,
     it is interpreted as a list of packages separated by a vertical
     slash character '<code>|</code>'. The constructor tries to load 
     the class named:
     <ul><code>
         &lt;<i>package</i>&gt;.&lt;<i>protocol</i>&gt;.Handler
     </code></ul>
     where &lt;<i>package</i>&gt; is replaced by the name of the package
     and &lt;<i>protocol</i>&gt; is replaced by the name of the protocol.
     If this class does not exist, or if the class exists but it is not
     a subclass of <code>URLStreamHandler</code>, then the next package
     in the list is tried.
 <li>If the previous step fails to find a protocol handler, then the
     constructor tries to load the class named:
     <ul><code>
         sun.net.www.protocol.&lt;<i>protocol</i>&gt;.Handler
     </code></ul>
     If this class does not exist, or if the class exists but it is not a
     subclass of <code>URLStreamHandler</code>, then a
     <code>MalformedURLException</code> is thrown.
 </ol>
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> protocol - the name of the protocol.
    <dd> host - the name of the host.
    <dd> port - the port number.
    <dd> file - the host file.
    <dt> <b>Throws:</b> <a href="java.net.MalformedURLException.html#_top_">MalformedURLException</a>
    <dd> if an unknown protocol is specified.
    <dt> <b>See Also:</b>
    <dd> <a href="java.lang.System.html#getProperty(java.lang.String)">getProperty</a>, <a href="#setURLStreamHandlerFactory(java.net.URLStreamHandlerFactory)">setURLStreamHandlerFactory</a>, <a href="java.net.URLStreamHandler.html#_top_">URLStreamHandler</a>, <a href="java.net.URLStreamHandlerFactory.html#createURLStreamHandler(java.lang.String)">createURLStreamHandler</a>
  </dl></dd>
</dl>
<a name="URL(java.lang.String, java.lang.String, java.lang.String)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>URL</b>
<pre>
 public URL(<a href="java.lang.String.html#_top_">String</a> protocol,
            <a href="java.lang.String.html#_top_">String</a> host,
            <a href="java.lang.String.html#_top_">String</a> file) throws <a href="java.net.MalformedURLException.html#_top_">MalformedURLException</a>
</pre>
<dl>
  <dd> Creates an absolute URL from the specified <code>protocol</code> 
 name, <code>host</code> name, and <code>file</code> name. The 
 default port for the specified protocol is used. 
 <p>
 This method is equivalent to calling the four-argument 
 constructor with the arguments being <code>protocol</code>, 
 <code>host</code>, <code>-1</code>, and <code>file</code>.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> protocol - the protocol to use.
    <dd> host - the host to connect to.
    <dd> file - the file on that host.
    <dt> <b>Throws:</b> <a href="java.net.MalformedURLException.html#_top_">MalformedURLException</a>
    <dd> if an unknown protocol is specified.
    <dt> <b>See Also:</b>
    <dd> <a href="#URL(java.lang.String, java.lang.String, int, java.lang.String)">URL</a>
  </dl></dd>
</dl>
<a name="URL(java.lang.String)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>URL</b>
<pre>
 public URL(<a href="java.lang.String.html#_top_">String</a> spec) throws <a href="java.net.MalformedURLException.html#_top_">MalformedURLException</a>
</pre>
<dl>
  <dd> Creates a <code>URL</code> object from the <code>String</code> 
 representation. 
 <p>
 This constructor is equivalent to a call to the two-argument 
 constructor with a <code>null</code> first argument.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> spec - the <code>String</code> to parse as a URL.
    <dt> <b>Throws:</b> <a href="java.net.MalformedURLException.html#_top_">MalformedURLException</a>
    <dd> If the string specifies an
               unknown protocol.
    <dt> <b>See Also:</b>
    <dd> <a href="#URL(java.net.URL, java.lang.String)">URL</a>
  </dl></dd>
</dl>
<a name="URL(java.net.URL, java.lang.String)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>URL</b>
<pre>
 public URL(<a href="#_top_">URL</a> context,
            <a href="java.lang.String.html#_top_">String</a> spec) throws <a href="java.net.MalformedURLException.html#_top_">MalformedURLException</a>
</pre>
<dl>
  <dd> Creates a URL by parsing the specification <code>spec</code> 
 within a specified context. If the <code>context</code> argument 
 is not <code>null</code> and the <code>spec</code> argument is a 
 partial URL specification, then any of the strings missing 
 components are inherited from the <code>context</code> argument. 
 <p>
 The specification given by the <code>String</code> argument is 
 parsed to determine if it specifies a protocol. If the 
 <code>String</code> contains an ASCII colon '<code>:</code>'
 character before the first occurrence of an ASCII slash character 
 '<code>/</code>', then the characters before the colon comprise 
 the protocol. 
 <ul>
 <li>If the <code>spec</code> argument does not specify a protocol:
     <ul>
     <li>If the context argument is not <code>null</code>, then the
         protocol is copied from the context argument.
     <li>If the context argument is <code>null</code>, then a
         <code>MalformedURLException</code> is thrown.
     </ul>
 <li>If the <code>spec</code> argument does specify a protocol:
     <ul>
     <li>If the context argument is <code>null</code>, or specifies a
         different protocol than the specification argument, the context
         argument is ignored.
     <li>If the context argument is not <code>null</code> and specifies
         the same protocol as the specification, the <code>host</code>,
         <code>port</code> number, and <code>file</code> are copied from
         the context argument into the newly created <code>URL</code>.
     </ul>
 </ul>
 <p>
 The constructor then searches for an appropriate stream protocol 
 handler of type <code>URLStreamHandler</code> as outlined for:
 <ul><code>
     java.net.URL#URL(java.lang.String, java.lang.String, int,
                      java.lang.String)
 </code></ul>
 The stream protocol handler's 
 <code>parseURL</code> method is called to parse the remaining 
 fields of the specification that override any defaults set by the 
 context argument.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> context - the context in which to parse the specification.
    <dd> spec - a <code>String</code> representation of a URL.
    <dt> <b>Throws:</b> <a href="java.net.MalformedURLException.html#_top_">MalformedURLException</a>
    <dd> if no protocol is specified, or an
               unknown protocol is found.
    <dt> <b>See Also:</b>
    <dd> <a href="#URL(java.lang.String, java.lang.String, int, java.lang.String)">URL</a>, <a href="java.net.URLStreamHandler.html#_top_">URLStreamHandler</a>, <a href="java.net.URLStreamHandler.html#parseURL(java.net.URL, java.lang.String, int, int)">parseURL</a>
  </dl></dd>
</dl>
<a name="methods"></a>
<h2>
  <img src="images/methods.gif" width=151 height=38 alt="Methods">
</h2>
<a name="set(java.lang.String, java.lang.String, int, java.lang.String, java.lang.String)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="set"><b>set</b></a>
<pre>
 protected void set(<a href="java.lang.String.html#_top_">String</a> protocol,
                    <a href="java.lang.String.html#_top_">String</a> host,
                    int port,
                    <a href="java.lang.String.html#_top_">String</a> file,
                    <a href="java.lang.String.html#_top_">String</a> ref)
</pre>
<dl>
  <dd> Sets the fields of the URL. This is not a public method so that 
 only URLStreamHandlers can modify URL fields. URLs are 
 otherwise constant.
 REMIND: this method will be moved to URLStreamHandler
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> protocol - the protocol to use
    <dd> host - the host name to connecto to
    <dd> port - the protocol port to connect to
    <dd> file - the specified file name on that host
    <dd> ref - the reference
  </dl></dd>
</dl>
<a name="getPort()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getPort"><b>getPort</b></a>
<pre>
 public int getPort()
</pre>
<dl>
  <dd> Returns the port number of this <code>URL</code>.
 Returns -1 if the port is not set.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the port number
  </dl></dd>
</dl>
<a name="getProtocol()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getProtocol"><b>getProtocol</b></a>
<pre>
 public <a href="java.lang.String.html#_top_">String</a> getProtocol()
</pre>
<dl>
  <dd> Returns the protocol name this <code>URL</code>.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the protocol of this <code>URL</code>.
  </dl></dd>
</dl>
<a name="getHost()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getHost"><b>getHost</b></a>
<pre>
 public <a href="java.lang.String.html#_top_">String</a> getHost()
</pre>
<dl>
  <dd> Returns the host name of this <code>URL</code>, if applicable.
 For "<code>file</code>" protocol, this is an empty string.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the host name of this <code>URL</code>.
  </dl></dd>
</dl>
<a name="getFile()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getFile"><b>getFile</b></a>
<pre>
 public <a href="java.lang.String.html#_top_">String</a> getFile()
</pre>
<dl>
  <dd> Returns the file name of this <code>URL</code>.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the file name of this <code>URL</code>.
  </dl></dd>
</dl>
<a name="getRef()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getRef"><b>getRef</b></a>
<pre>
 public <a href="java.lang.String.html#_top_">String</a> getRef()
</pre>
<dl>
  <dd> Returns the anchor (also known as the "reference") of this
 <code>URL</code>.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the anchor (also known as the "reference") of this
          <code>URL</code>.
  </dl></dd>
</dl>
<a name="equals(java.lang.Object)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="equals"><b>equals</b></a>
<pre>
 public boolean equals(<a href="java.lang.Object.html#_top_">Object</a> obj)
</pre>
<dl>
  <dd> Compares two URLs.
 The result is <code>true</code> if and only if the argument is 
 not <code>null</code> and is a <code>URL</code> object that 
 represents the same <code>URL</code> as this object. Two URL 
 objects are equal if they have the same protocol and reference the 
 same host, the same port number on the host, and the same file on 
 the host. The anchors of the URL objects are not compared. 
 <p>
 This method is equivalent to:
 <ul><code>
     (obj instanceof URL) &amp;&amp; sameFile((URL)obj)
 </code></ul>
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> obj - the URL to compare against.
    <dt> <b>Returns:</b>
    <dd> <code>true</code> if the objects are the same;
          <code>false</code> otherwise.
    <dt> <b>Overrides:</b>
    <dd> <a href="java.lang.Object.html#equals(java.lang.Object)">equals</a> in class <a href="java.lang.Object.html#_top_">Object</a>
  </dl></dd>
</dl>
<a name="hashCode()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="hashCode"><b>hashCode</b></a>
<pre>
 public int hashCode()
</pre>
<dl>
  <dd> Creates an integer suitable for hash table indexing.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> a hash code for this <code>URL</code>.
    <dt> <b>Overrides:</b>
    <dd> <a href="java.lang.Object.html#hashCode()">hashCode</a> in class <a href="java.lang.Object.html#_top_">Object</a>
  </dl></dd>
</dl>
<a name="sameFile(java.net.URL)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="sameFile"><b>sameFile</b></a>
<pre>
 public boolean sameFile(<a href="#_top_">URL</a> other)
</pre>
<dl>
  <dd> Compares two URLs, excluding the "ref" fields.
 Returns <code>true</code> if this <code>URL</code> and the 
 <code>other</code> argument both refer to the same resource.
 The two <code>URL</code>s might not both contain the same anchor.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> other - the <code>URL</code> to compare against.
    <dt> <b>Returns:</b>
    <dd> <code>true</code> if they reference the same remote object;
          <code>false</code> otherwise.
  </dl></dd>
</dl>
<a name="toString()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="toString"><b>toString</b></a>
<pre>
 public <a href="java.lang.String.html#_top_">String</a> toString()
</pre>
<dl>
  <dd> Constructs a string representation of this <code>URL</code>. The 
 string is created by calling the <code>toExternalForm</code> 
 method of the stream protocol handler for this object.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> a string representation of this object.
    <dt> <b>Overrides:</b>
    <dd> <a href="java.lang.Object.html#toString()">toString</a> in class <a href="java.lang.Object.html#_top_">Object</a>
    <dt> <b>See Also:</b>
    <dd> <a href="#URL(java.lang.String, java.lang.String, int, java.lang.String)">URL</a>, <a href="java.net.URLStreamHandler.html#toExternalForm(java.net.URL)">toExternalForm</a>
  </dl></dd>
</dl>
<a name="toExternalForm()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="toExternalForm"><b>toExternalForm</b></a>
<pre>
 public <a href="java.lang.String.html#_top_">String</a> toExternalForm()
</pre>
<dl>
  <dd> Constructs a string representation of this <code>URL</code>. The 
 string is created by calling the <code>toExternalForm</code> 
 method of the stream protocol handler for this object.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> a string representation of this object.
    <dt> <b>See Also:</b>
    <dd> <a href="#URL(java.lang.String, java.lang.String, int, java.lang.String)">URL</a>, <a href="java.net.URLStreamHandler.html#toExternalForm(java.net.URL)">toExternalForm</a>
  </dl></dd>
</dl>
<a name="openConnection()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="openConnection"><b>openConnection</b></a>
<pre>
 public <a href="java.net.URLConnection.html#_top_">URLConnection</a> openConnection() throws <a href="java.io.IOException.html#_top_">IOException</a>
</pre>
<dl>
  <dd> Returns a <code>URLConnection</code> object that represents a 
 connection to the remote object referred to by the <code>URL</code>.
 <p>
 If there is not already an open connection, the connection is 
 opened by calling the <code>openConnection</code> method of the 
 protocol handler for this URL.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> a <code>URLConnection</code> to the URL.
    <dt> <b>Throws:</b> <a href="java.io.IOException.html#_top_">IOException</a>
    <dd> if an I/O exception occurs.
    <dt> <b>See Also:</b>
    <dd> <a href="#URL(java.lang.String, java.lang.String, int, java.lang.String)">URL</a>, <a href="java.net.URLConnection.html#_top_">URLConnection</a>, <a href="java.net.URLStreamHandler.html#openConnection(java.net.URL)">openConnection</a>
  </dl></dd>
</dl>
<a name="openStream()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="openStream"><b>openStream</b></a>
<pre>
 public final <a href="java.io.InputStream.html#_top_">InputStream</a> openStream() throws <a href="java.io.IOException.html#_top_">IOException</a>
</pre>
<dl>
  <dd> Opens a connection to this <code>URL</code> and returns an 
 <code>InputStream</code> for reading from that connection. This 
 method is a shorthand for:
 <ul><code>
     openConnection().getInputStream()
 </code></ul>
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> an input stream for reading from the URL connection.
    <dt> <b>Throws:</b> <a href="java.io.IOException.html#_top_">IOException</a>
    <dd> if an I/O exception occurs.
  </dl></dd>
</dl>
<a name="getContent()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getContent"><b>getContent</b></a>
<pre>
 public final <a href="java.lang.Object.html#_top_">Object</a> getContent() throws <a href="java.io.IOException.html#_top_">IOException</a>
</pre>
<dl>
  <dd> Returns the contents of this URL. This method is a shorthand for:
 <ul><code>
     openConnection().getContent()
 </code></ul>
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the contents of this URL.
    <dt> <b>Throws:</b> <a href="java.io.IOException.html#_top_">IOException</a>
    <dd> if an I/O exception occurs.
    <dt> <b>See Also:</b>
    <dd> <a href="java.net.URLConnection.html#getContent()">getContent</a>
  </dl></dd>
</dl>
<a name="setURLStreamHandlerFactory(java.net.URLStreamHandlerFactory)"><img src="images/green-ball.gif" width=12 height=12 alt=" o "></a>
<a name="setURLStreamHandlerFactory"><b>setURLStreamHandlerFactory</b></a>
<pre>
 public static synchronized void setURLStreamHandlerFactory(<a href="java.net.URLStreamHandlerFactory.html#_top_">URLStreamHandlerFactory</a> fac)
</pre>
<dl>
  <dd> Sets an application's <code>URLStreamHandlerFactory</code>.
 This method can be called at most once by an application. 
 <p>
 The <code>URLStreamHandlerFactory</code> instance is used to 
 construct a stream protocol handler from a protocol name.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> fac - the desired factory.
    <dt> <b>Throws:</b> <a href="java.lang.Error.html#_top_">Error</a>
    <dd> if the application has already set a factory.
    <dt> <b>See Also:</b>
    <dd> <a href="#URL(java.lang.String, java.lang.String, int, java.lang.String)">URL</a>, <a href="java.net.URLStreamHandlerFactory.html#_top_">URLStreamHandlerFactory</a>
  </dl></dd>
</dl>
<hr>
<pre>
<a href="packages.html">All Packages</a>  <a href="tree.html">Class Hierarchy</a>  <a href="Package-java.net.html">This Package</a>  <a href="java.net.SocketImpl.html#_top_">Previous</a>  <a href="java.net.URLConnection.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
</body>
</html>
