jdk/src/share/classes/java/net/URI.java
changeset 19069 1d9cb0d080e3
parent 19049 543b417ea7b2
child 20455 f6f9a0c2796b
--- a/jdk/src/share/classes/java/net/URI.java	Mon Jul 29 19:36:54 2013 -0700
+++ b/jdk/src/share/classes/java/net/URI.java	Tue Jul 30 11:04:19 2013 -0700
@@ -67,24 +67,24 @@
  * form has the syntax
  *
  * <blockquote>
- * [<i>scheme</i><tt><b>:</b></tt>]<i>scheme-specific-part</i>[<tt><b>#</b></tt><i>fragment</i>]
+ * [<i>scheme</i><b>{@code :}</b>]<i>scheme-specific-part</i>[<b>{@code #}</b><i>fragment</i>]
  * </blockquote>
  *
  * where square brackets [...] delineate optional components and the characters
- * <tt><b>:</b></tt> and <tt><b>#</b></tt> stand for themselves.
+ * <b>{@code :}</b> and <b>{@code #}</b> stand for themselves.
  *
  * <p> An <i>absolute</i> URI specifies a scheme; a URI that is not absolute is
  * said to be <i>relative</i>.  URIs are also classified according to whether
  * they are <i>opaque</i> or <i>hierarchical</i>.
  *
  * <p> An <i>opaque</i> URI is an absolute URI whose scheme-specific part does
- * not begin with a slash character (<tt>'/'</tt>).  Opaque URIs are not
+ * not begin with a slash character ({@code '/'}).  Opaque URIs are not
  * subject to further parsing.  Some examples of opaque URIs are:
  *
  * <blockquote><table cellpadding=0 cellspacing=0 summary="layout">
- * <tr><td><tt>mailto:java-net@java.sun.com</tt><td></tr>
- * <tr><td><tt>news:comp.lang.java</tt><td></tr>
- * <tr><td><tt>urn:isbn:096139210x</tt></td></tr>
+ * <tr><td>{@code mailto:java-net@java.sun.com}<td></tr>
+ * <tr><td>{@code news:comp.lang.java}<td></tr>
+ * <tr><td>{@code urn:isbn:096139210x}</td></tr>
  * </table></blockquote>
  *
  * <p> A <i>hierarchical</i> URI is either an absolute URI whose
@@ -93,20 +93,20 @@
  * URIs are:
  *
  * <blockquote>
- * <tt>http://java.sun.com/j2se/1.3/</tt><br>
- * <tt>docs/guide/collections/designfaq.html#28</tt><br>
- * <tt>../../../demo/jfc/SwingSet2/src/SwingSet2.java</tt><br>
- * <tt>file:///~/calendar</tt>
+ * {@code http://java.sun.com/j2se/1.3/}<br>
+ * {@code docs/guide/collections/designfaq.html#28}<br>
+ * {@code ../../../demo/jfc/SwingSet2/src/SwingSet2.java}<br>
+ * {@code file:///~/calendar}
  * </blockquote>
  *
  * <p> A hierarchical URI is subject to further parsing according to the syntax
  *
  * <blockquote>
- * [<i>scheme</i><tt><b>:</b></tt>][<tt><b>//</b></tt><i>authority</i>][<i>path</i>][<tt><b>?</b></tt><i>query</i>][<tt><b>#</b></tt><i>fragment</i>]
+ * [<i>scheme</i><b>{@code :}</b>][<b>{@code //}</b><i>authority</i>][<i>path</i>][<b>{@code ?}</b><i>query</i>][<b>{@code #}</b><i>fragment</i>]
  * </blockquote>
  *
- * where the characters <tt><b>:</b></tt>, <tt><b>/</b></tt>,
- * <tt><b>?</b></tt>, and <tt><b>#</b></tt> stand for themselves.  The
+ * where the characters <b>{@code :}</b>, <b>{@code /}</b>,
+ * <b>{@code ?}</b>, and <b>{@code #}</b> stand for themselves.  The
  * scheme-specific part of a hierarchical URI consists of the characters
  * between the scheme and fragment components.
  *
@@ -115,16 +115,16 @@
  * parses according to the familiar syntax
  *
  * <blockquote>
- * [<i>user-info</i><tt><b>@</b></tt>]<i>host</i>[<tt><b>:</b></tt><i>port</i>]
+ * [<i>user-info</i><b>{@code @}</b>]<i>host</i>[<b>{@code :}</b><i>port</i>]
  * </blockquote>
  *
- * where the characters <tt><b>@</b></tt> and <tt><b>:</b></tt> stand for
+ * where the characters <b>{@code @}</b> and <b>{@code :}</b> stand for
  * themselves.  Nearly all URI schemes currently in use are server-based.  An
  * authority component that does not parse in this way is considered to be
  * registry-based.
  *
  * <p> The path component of a hierarchical URI is itself said to be absolute
- * if it begins with a slash character (<tt>'/'</tt>); otherwise it is
+ * if it begins with a slash character ({@code '/'}); otherwise it is
  * relative.  The path of a hierarchical URI that is either absolute or
  * specifies an authority is always absolute.
  *
@@ -132,21 +132,21 @@
  *
  * <blockquote><table summary="Describes the components of a URI:scheme,scheme-specific-part,authority,user-info,host,port,path,query,fragment">
  * <tr><th><i>Component</i></th><th><i>Type</i></th></tr>
- * <tr><td>scheme</td><td><tt>String</tt></td></tr>
- * <tr><td>scheme-specific-part&nbsp;&nbsp;&nbsp;&nbsp;</td><td><tt>String</tt></td></tr>
- * <tr><td>authority</td><td><tt>String</tt></td></tr>
- * <tr><td>user-info</td><td><tt>String</tt></td></tr>
- * <tr><td>host</td><td><tt>String</tt></td></tr>
- * <tr><td>port</td><td><tt>int</tt></td></tr>
- * <tr><td>path</td><td><tt>String</tt></td></tr>
- * <tr><td>query</td><td><tt>String</tt></td></tr>
- * <tr><td>fragment</td><td><tt>String</tt></td></tr>
+ * <tr><td>scheme</td><td>{@code String}</td></tr>
+ * <tr><td>scheme-specific-part&nbsp;&nbsp;&nbsp;&nbsp;</td><td>{@code String}</td></tr>
+ * <tr><td>authority</td><td>{@code String}</td></tr>
+ * <tr><td>user-info</td><td>{@code String}</td></tr>
+ * <tr><td>host</td><td>{@code String}</td></tr>
+ * <tr><td>port</td><td>{@code int}</td></tr>
+ * <tr><td>path</td><td>{@code String}</td></tr>
+ * <tr><td>query</td><td>{@code String}</td></tr>
+ * <tr><td>fragment</td><td>{@code String}</td></tr>
  * </table></blockquote>
  *
  * In a given instance any particular component is either <i>undefined</i> or
  * <i>defined</i> with a distinct value.  Undefined string components are
- * represented by <tt>null</tt>, while undefined integer components are
- * represented by <tt>-1</tt>.  A string component may be defined to have the
+ * represented by {@code null}, while undefined integer components are
+ * represented by {@code -1}.  A string component may be defined to have the
  * empty string as its value; this is not equivalent to that component being
  * undefined.
  *
@@ -165,10 +165,10 @@
  * The key operations supported by this class are those of
  * <i>normalization</i>, <i>resolution</i>, and <i>relativization</i>.
  *
- * <p> <i>Normalization</i> is the process of removing unnecessary <tt>"."</tt>
- * and <tt>".."</tt> segments from the path component of a hierarchical URI.
- * Each <tt>"."</tt> segment is simply removed.  A <tt>".."</tt> segment is
- * removed only if it is preceded by a non-<tt>".."</tt> segment.
+ * <p> <i>Normalization</i> is the process of removing unnecessary {@code "."}
+ * and {@code ".."} segments from the path component of a hierarchical URI.
+ * Each {@code "."} segment is simply removed.  A {@code ".."} segment is
+ * removed only if it is preceded by a non-{@code ".."} segment.
  * Normalization has no effect upon opaque URIs.
  *
  * <p> <i>Resolution</i> is the process of resolving one URI against another,
@@ -179,45 +179,47 @@
  * normalized.  The result, for example, of resolving
  *
  * <blockquote>
- * <tt>docs/guide/collections/designfaq.html#28&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt>(1)
+ * {@code docs/guide/collections/designfaq.html#28}
+ * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ * &nbsp;&nbsp;&nbsp;&nbsp;(1)
  * </blockquote>
  *
- * against the base URI <tt>http://java.sun.com/j2se/1.3/</tt> is the result
+ * against the base URI {@code http://java.sun.com/j2se/1.3/} is the result
  * URI
  *
  * <blockquote>
- * <tt>http://java.sun.com/j2se/1.3/docs/guide/collections/designfaq.html#28</tt>
+ * {@code http://java.sun.com/j2se/1.3/docs/guide/collections/designfaq.html#28}
  * </blockquote>
  *
  * Resolving the relative URI
  *
  * <blockquote>
- * <tt>../../../demo/jfc/SwingSet2/src/SwingSet2.java&nbsp;&nbsp;&nbsp;&nbsp;</tt>(2)
+ * {@code ../../../demo/jfc/SwingSet2/src/SwingSet2.java}&nbsp;&nbsp;&nbsp;&nbsp;(2)
  * </blockquote>
  *
  * against this result yields, in turn,
  *
  * <blockquote>
- * <tt>http://java.sun.com/j2se/1.3/demo/jfc/SwingSet2/src/SwingSet2.java</tt>
+ * {@code http://java.sun.com/j2se/1.3/demo/jfc/SwingSet2/src/SwingSet2.java}
  * </blockquote>
  *
  * Resolution of both absolute and relative URIs, and of both absolute and
  * relative paths in the case of hierarchical URIs, is supported.  Resolving
- * the URI <tt>file:///~calendar</tt> against any other URI simply yields the
+ * the URI {@code file:///~calendar} against any other URI simply yields the
  * original URI, since it is absolute.  Resolving the relative URI (2) above
  * against the relative base URI (1) yields the normalized, but still relative,
  * URI
  *
  * <blockquote>
- * <tt>demo/jfc/SwingSet2/src/SwingSet2.java</tt>
+ * {@code demo/jfc/SwingSet2/src/SwingSet2.java}
  * </blockquote>
  *
  * <p> <i>Relativization</i>, finally, is the inverse of resolution: For any
  * two normalized URIs <i>u</i> and&nbsp;<i>v</i>,
  *
  * <blockquote>
- *   <i>u</i><tt>.relativize(</tt><i>u</i><tt>.resolve(</tt><i>v</i><tt>)).equals(</tt><i>v</i><tt>)</tt>&nbsp;&nbsp;and<br>
- *   <i>u</i><tt>.resolve(</tt><i>u</i><tt>.relativize(</tt><i>v</i><tt>)).equals(</tt><i>v</i><tt>)</tt>&nbsp;&nbsp;.<br>
+ *   <i>u</i>{@code .relativize(}<i>u</i>{@code .resolve(}<i>v</i>{@code )).equals(}<i>v</i>{@code )}&nbsp;&nbsp;and<br>
+ *   <i>u</i>{@code .resolve(}<i>u</i>{@code .relativize(}<i>v</i>{@code )).equals(}<i>v</i>{@code )}&nbsp;&nbsp;.<br>
  * </blockquote>
  *
  * This operation is often useful when constructing a document containing URIs
@@ -225,16 +227,16 @@
  * possible.  For example, relativizing the URI
  *
  * <blockquote>
- * <tt>http://java.sun.com/j2se/1.3/docs/guide/index.html</tt>
+ * {@code http://java.sun.com/j2se/1.3/docs/guide/index.html}
  * </blockquote>
  *
  * against the base URI
  *
  * <blockquote>
- * <tt>http://java.sun.com/j2se/1.3</tt>
+ * {@code http://java.sun.com/j2se/1.3}
  * </blockquote>
  *
- * yields the relative URI <tt>docs/guide/index.html</tt>.
+ * yields the relative URI {@code docs/guide/index.html}.
  *
  *
  * <h4> Character categories </h4>
@@ -247,26 +249,26 @@
  * <blockquote><table cellspacing=2 summary="Describes categories alpha,digit,alphanum,unreserved,punct,reserved,escaped,and other">
  *   <tr><th valign=top><i>alpha</i></th>
  *       <td>The US-ASCII alphabetic characters,
- *        <tt>'A'</tt>&nbsp;through&nbsp;<tt>'Z'</tt>
- *        and <tt>'a'</tt>&nbsp;through&nbsp;<tt>'z'</tt></td></tr>
+ *        {@code 'A'}&nbsp;through&nbsp;{@code 'Z'}
+ *        and {@code 'a'}&nbsp;through&nbsp;{@code 'z'}</td></tr>
  *   <tr><th valign=top><i>digit</i></th>
  *       <td>The US-ASCII decimal digit characters,
- *       <tt>'0'</tt>&nbsp;through&nbsp;<tt>'9'</tt></td></tr>
+ *       {@code '0'}&nbsp;through&nbsp;{@code '9'}</td></tr>
  *   <tr><th valign=top><i>alphanum</i></th>
  *       <td>All <i>alpha</i> and <i>digit</i> characters</td></tr>
  *   <tr><th valign=top><i>unreserved</i>&nbsp;&nbsp;&nbsp;&nbsp;</th>
  *       <td>All <i>alphanum</i> characters together with those in the string
- *        <tt>"_-!.~'()*"</tt></td></tr>
+ *        {@code "_-!.~'()*"}</td></tr>
  *   <tr><th valign=top><i>punct</i></th>
- *       <td>The characters in the string <tt>",;:$&amp;+="</tt></td></tr>
+ *       <td>The characters in the string {@code ",;:$&+="}</td></tr>
  *   <tr><th valign=top><i>reserved</i></th>
  *       <td>All <i>punct</i> characters together with those in the string
- *        <tt>"?/[]@"</tt></td></tr>
+ *        {@code "?/[]@"}</td></tr>
  *   <tr><th valign=top><i>escaped</i></th>
  *       <td>Escaped octets, that is, triplets consisting of the percent
- *           character (<tt>'%'</tt>) followed by two hexadecimal digits
- *           (<tt>'0'</tt>-<tt>'9'</tt>, <tt>'A'</tt>-<tt>'F'</tt>, and
- *           <tt>'a'</tt>-<tt>'f'</tt>)</td></tr>
+ *           character ({@code '%'}) followed by two hexadecimal digits
+ *           ({@code '0'}-{@code '9'}, {@code 'A'}-{@code 'F'}, and
+ *           {@code 'a'}-{@code 'f'})</td></tr>
  *   <tr><th valign=top><i>other</i></th>
  *       <td>The Unicode characters that are not in the US-ASCII character set,
  *           are not control characters (according to the {@link
@@ -306,14 +308,14 @@
  *
  *   <li><p><a name="encode"></a> A character is <i>encoded</i> by replacing it
  *   with the sequence of escaped octets that represent that character in the
- *   UTF-8 character set.  The Euro currency symbol (<tt>'&#92;u20AC'</tt>),
- *   for example, is encoded as <tt>"%E2%82%AC"</tt>.  <i>(<b>Deviation from
+ *   UTF-8 character set.  The Euro currency symbol ({@code '\u005Cu20AC'}),
+ *   for example, is encoded as {@code "%E2%82%AC"}.  <i>(<b>Deviation from
  *   RFC&nbsp;2396</b>, which does not specify any particular character
  *   set.)</i> </p></li>
  *
  *   <li><p><a name="quote"></a> An illegal character is <i>quoted</i> simply by
  *   encoding it.  The space character, for example, is quoted by replacing it
- *   with <tt>"%20"</tt>.  UTF-8 contains US-ASCII, hence for US-ASCII
+ *   with {@code "%20"}.  UTF-8 contains US-ASCII, hence for US-ASCII
  *   characters this transformation has exactly the effect required by
  *   RFC&nbsp;2396. </p></li>
  *
@@ -325,7 +327,7 @@
  *   decoding any encoded non-US-ASCII characters.  If a <a
  *   href="../nio/charset/CharsetDecoder.html#ce">decoding error</a> occurs
  *   when decoding the escaped octets then the erroneous octets are replaced by
- *   <tt>'&#92;uFFFD'</tt>, the Unicode replacement character.  </p></li>
+ *   {@code '\u005CuFFFD'}, the Unicode replacement character.  </p></li>
  *
  * </ul>
  *
@@ -343,7 +345,7 @@
  *   #URI(java.lang.String,java.lang.String,java.lang.String,int,java.lang.String,java.lang.String,java.lang.String)
  *   multi-argument constructors} quote illegal characters as
  *   required by the components in which they appear.  The percent character
- *   (<tt>'%'</tt>) is always quoted by these constructors.  Any <i>other</i>
+ *   ({@code '%'}) is always quoted by these constructors.  Any <i>other</i>
  *   characters are preserved.  </p></li>
  *
  *   <li><p> The {@link #getRawUserInfo() getRawUserInfo}, {@link #getRawPath()
@@ -379,42 +381,33 @@
  * For any URI <i>u</i>, it is always the case that
  *
  * <blockquote>
- * <tt>new URI(</tt><i>u</i><tt>.toString()).equals(</tt><i>u</i><tt>)</tt>&nbsp;.
+ * {@code new URI(}<i>u</i>{@code .toString()).equals(}<i>u</i>{@code )}&nbsp;.
  * </blockquote>
  *
  * For any URI <i>u</i> that does not contain redundant syntax such as two
- * slashes before an empty authority (as in <tt>file:///tmp/</tt>&nbsp;) or a
+ * slashes before an empty authority (as in {@code file:///tmp/}&nbsp;) or a
  * colon following a host name but no port (as in
- * <tt>http://java.sun.com:</tt>&nbsp;), and that does not encode characters
+ * {@code http://java.sun.com:}&nbsp;), and that does not encode characters
  * except those that must be quoted, the following identities also hold:
- *
- * <blockquote>
- * <tt>new URI(</tt><i>u</i><tt>.getScheme(),<br>
- * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt><i>u</i><tt>.getSchemeSpecificPart(),<br>
- * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt><i>u</i><tt>.getFragment())<br>
- * .equals(</tt><i>u</i><tt>)</tt>
- * </blockquote>
- *
+ * <p><pre>
+ *     new URI(<i>u</i>.getScheme(),
+ *             <i>u</i>.getSchemeSpecificPart(),
+ *             <i>u</i>.getFragment())
+ *     .equals(<i>u</i>)</pre>
  * in all cases,
- *
- * <blockquote>
- * <tt>new URI(</tt><i>u</i><tt>.getScheme(),<br>
- * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt><i>u</i><tt>.getUserInfo(),&nbsp;</tt><i>u</i><tt>.getAuthority(),<br>
- * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt><i>u</i><tt>.getPath(),&nbsp;</tt><i>u</i><tt>.getQuery(),<br>
- * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt><i>u</i><tt>.getFragment())<br>
- * .equals(</tt><i>u</i><tt>)</tt>
- * </blockquote>
- *
+ * <p><pre>
+ *     new URI(<i>u</i>.getScheme(),
+ *             <i>u</i>.getUserInfo(), <i>u</i>.getAuthority(),
+ *             <i>u</i>.getPath(), <i>u</i>.getQuery(),
+ *             <i>u</i>.getFragment())
+ *     .equals(<i>u</i>)</pre>
  * if <i>u</i> is hierarchical, and
- *
- * <blockquote>
- * <tt>new URI(</tt><i>u</i><tt>.getScheme(),<br>
- * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt><i>u</i><tt>.getUserInfo(),&nbsp;</tt><i>u</i><tt>.getHost(),&nbsp;</tt><i>u</i><tt>.getPort(),<br>
- * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt><i>u</i><tt>.getPath(),&nbsp;</tt><i>u</i><tt>.getQuery(),<br>
- * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt><i>u</i><tt>.getFragment())<br>
- * .equals(</tt><i>u</i><tt>)</tt>
- * </blockquote>
- *
+ * <p><pre>
+ *     new URI(<i>u</i>.getScheme(),
+ *             <i>u</i>.getUserInfo(), <i>u</i>.getHost(), <i>u</i>.getPort(),
+ *             <i>u</i>.getPath(), <i>u</i>.getQuery(),
+ *             <i>u</i>.getFragment())
+ *     .equals(<i>u</i>)</pre>
  * if <i>u</i> is hierarchical and has either no authority or a server-based
  * authority.
  *
@@ -425,8 +418,8 @@
  * resource <i>locator</i>.  Hence every URL is a URI, abstractly speaking, but
  * not every URI is a URL.  This is because there is another subcategory of
  * URIs, uniform resource <i>names</i> (URNs), which name resources but do not
- * specify how to locate them.  The <tt>mailto</tt>, <tt>news</tt>, and
- * <tt>isbn</tt> URIs shown above are examples of URNs.
+ * specify how to locate them.  The {@code mailto}, {@code news}, and
+ * {@code isbn} URIs shown above are examples of URNs.
  *
  * <p> The conceptual distinction between URIs and URLs is reflected in the
  * differences between this class and the {@link URL} class.
@@ -535,7 +528,7 @@
      *   <li><p> An empty authority component is permitted as long as it is
      *   followed by a non-empty path, a query component, or a fragment
      *   component.  This allows the parsing of URIs such as
-     *   <tt>"file:///foo/bar"</tt>, which seems to be the intent of
+     *   {@code "file:///foo/bar"}, which seems to be the intent of
      *   RFC&nbsp;2396 although the grammar does not permit it.  If the
      *   authority component is empty then the user-information, host, and port
      *   components are undefined. </p></li>
@@ -543,7 +536,7 @@
      *   <li><p> Empty relative paths are permitted; this seems to be the
      *   intent of RFC&nbsp;2396 although the grammar does not permit it.  The
      *   primary consequence of this deviation is that a standalone fragment
-     *   such as <tt>"#foo"</tt> parses as a relative URI with an empty path
+     *   such as {@code "#foo"} parses as a relative URI with an empty path
      *   and the given fragment, and can be usefully <a
      *   href="#resolve-frag">resolved</a> against a base URI.
      *
@@ -560,12 +553,12 @@
      *   href="http://www.ietf.org/rfc/rfc2396.txt">RFC&nbsp;2396</a>
      *   section&nbsp;3.2.2 although the grammar does not permit it. The
      *   consequence of this deviation is that the authority component of a
-     *   hierarchical URI such as <tt>s://123</tt>, will parse as a server-based
+     *   hierarchical URI such as {@code s://123}, will parse as a server-based
      *   authority. </p></li>
      *
      *   <li><p> IPv6 addresses are permitted for the host component.  An IPv6
-     *   address must be enclosed in square brackets (<tt>'['</tt> and
-     *   <tt>']'</tt>) as specified by <a
+     *   address must be enclosed in square brackets ({@code '['} and
+     *   {@code ']'}) as specified by <a
      *   href="http://www.ietf.org/rfc/rfc2732.txt">RFC&nbsp;2732</a>.  The
      *   IPv6 address itself must parse according to <a
      *   href="http://www.ietf.org/rfc/rfc2373.txt">RFC&nbsp;2373</a>.  IPv6
@@ -585,7 +578,7 @@
      * @param  str   The string to be parsed into a URI
      *
      * @throws  NullPointerException
-     *          If <tt>str</tt> is <tt>null</tt>
+     *          If {@code str} is {@code null}
      *
      * @throws  URISyntaxException
      *          If the given string violates RFC&nbsp;2396, as augmented
@@ -599,10 +592,10 @@
      * Constructs a hierarchical URI from the given components.
      *
      * <p> If a scheme is given then the path, if also given, must either be
-     * empty or begin with a slash character (<tt>'/'</tt>).  Otherwise a
-     * component of the new URI may be left undefined by passing <tt>null</tt>
-     * for the corresponding parameter or, in the case of the <tt>port</tt>
-     * parameter, by passing <tt>-1</tt>.
+     * empty or begin with a slash character ({@code '/'}).  Otherwise a
+     * component of the new URI may be left undefined by passing {@code null}
+     * for the corresponding parameter or, in the case of the {@code port}
+     * parameter, by passing {@code -1}.
      *
      * <p> This constructor first builds a URI string from the given components
      * according to the rules specified in <a
@@ -614,37 +607,37 @@
      *   <li><p> Initially, the result string is empty. </p></li>
      *
      *   <li><p> If a scheme is given then it is appended to the result,
-     *   followed by a colon character (<tt>':'</tt>).  </p></li>
+     *   followed by a colon character ({@code ':'}).  </p></li>
      *
      *   <li><p> If user information, a host, or a port are given then the
-     *   string <tt>"//"</tt> is appended.  </p></li>
+     *   string {@code "//"} is appended.  </p></li>
      *
      *   <li><p> If user information is given then it is appended, followed by
-     *   a commercial-at character (<tt>'@'</tt>).  Any character not in the
+     *   a commercial-at character ({@code '@'}).  Any character not in the
      *   <i>unreserved</i>, <i>punct</i>, <i>escaped</i>, or <i>other</i>
      *   categories is <a href="#quote">quoted</a>.  </p></li>
      *
      *   <li><p> If a host is given then it is appended.  If the host is a
      *   literal IPv6 address but is not enclosed in square brackets
-     *   (<tt>'['</tt> and <tt>']'</tt>) then the square brackets are added.
+     *   ({@code '['} and {@code ']'}) then the square brackets are added.
      *   </p></li>
      *
      *   <li><p> If a port number is given then a colon character
-     *   (<tt>':'</tt>) is appended, followed by the port number in decimal.
+     *   ({@code ':'}) is appended, followed by the port number in decimal.
      *   </p></li>
      *
      *   <li><p> If a path is given then it is appended.  Any character not in
      *   the <i>unreserved</i>, <i>punct</i>, <i>escaped</i>, or <i>other</i>
-     *   categories, and not equal to the slash character (<tt>'/'</tt>) or the
-     *   commercial-at character (<tt>'@'</tt>), is quoted.  </p></li>
+     *   categories, and not equal to the slash character ({@code '/'}) or the
+     *   commercial-at character ({@code '@'}), is quoted.  </p></li>
      *
      *   <li><p> If a query is given then a question-mark character
-     *   (<tt>'?'</tt>) is appended, followed by the query.  Any character that
+     *   ({@code '?'}) is appended, followed by the query.  Any character that
      *   is not a <a href="#legal-chars">legal URI character</a> is quoted.
      *   </p></li>
      *
      *   <li><p> Finally, if a fragment is given then a hash character
-     *   (<tt>'#'</tt>) is appended, followed by the fragment.  Any character
+     *   ({@code '#'}) is appended, followed by the fragment.  Any character
      *   that is not a legal URI character is quoted.  </p></li>
      *
      * </ol>
@@ -684,8 +677,8 @@
      * Constructs a hierarchical URI from the given components.
      *
      * <p> If a scheme is given then the path, if also given, must either be
-     * empty or begin with a slash character (<tt>'/'</tt>).  Otherwise a
-     * component of the new URI may be left undefined by passing <tt>null</tt>
+     * empty or begin with a slash character ({@code '/'}).  Otherwise a
+     * component of the new URI may be left undefined by passing {@code null}
      * for the corresponding parameter.
      *
      * <p> This constructor first builds a URI string from the given components
@@ -698,28 +691,28 @@
      *   <li><p> Initially, the result string is empty.  </p></li>
      *
      *   <li><p> If a scheme is given then it is appended to the result,
-     *   followed by a colon character (<tt>':'</tt>).  </p></li>
+     *   followed by a colon character ({@code ':'}).  </p></li>
      *
-     *   <li><p> If an authority is given then the string <tt>"//"</tt> is
+     *   <li><p> If an authority is given then the string {@code "//"} is
      *   appended, followed by the authority.  If the authority contains a
      *   literal IPv6 address then the address must be enclosed in square
-     *   brackets (<tt>'['</tt> and <tt>']'</tt>).  Any character not in the
+     *   brackets ({@code '['} and {@code ']'}).  Any character not in the
      *   <i>unreserved</i>, <i>punct</i>, <i>escaped</i>, or <i>other</i>
      *   categories, and not equal to the commercial-at character
-     *   (<tt>'@'</tt>), is <a href="#quote">quoted</a>.  </p></li>
+     *   ({@code '@'}), is <a href="#quote">quoted</a>.  </p></li>
      *
      *   <li><p> If a path is given then it is appended.  Any character not in
      *   the <i>unreserved</i>, <i>punct</i>, <i>escaped</i>, or <i>other</i>
-     *   categories, and not equal to the slash character (<tt>'/'</tt>) or the
-     *   commercial-at character (<tt>'@'</tt>), is quoted.  </p></li>
+     *   categories, and not equal to the slash character ({@code '/'}) or the
+     *   commercial-at character ({@code '@'}), is quoted.  </p></li>
      *
      *   <li><p> If a query is given then a question-mark character
-     *   (<tt>'?'</tt>) is appended, followed by the query.  Any character that
+     *   ({@code '?'}) is appended, followed by the query.  Any character that
      *   is not a <a href="#legal-chars">legal URI character</a> is quoted.
      *   </p></li>
      *
      *   <li><p> Finally, if a fragment is given then a hash character
-     *   (<tt>'#'</tt>) is appended, followed by the fragment.  Any character
+     *   ({@code '#'}) is appended, followed by the fragment.  Any character
      *   that is not a legal URI character is quoted.  </p></li>
      *
      * </ol>
@@ -756,15 +749,15 @@
     /**
      * Constructs a hierarchical URI from the given components.
      *
-     * <p> A component may be left undefined by passing <tt>null</tt>.
+     * <p> A component may be left undefined by passing {@code null}.
      *
      * <p> This convenience constructor works as if by invoking the
      * seven-argument constructor as follows:
      *
-     * <blockquote><tt>
-     * new&nbsp;{@link #URI(String, String, String, int, String, String, String)
-     * URI}(scheme,&nbsp;null,&nbsp;host,&nbsp;-1,&nbsp;path,&nbsp;null,&nbsp;fragment);
-     * </tt></blockquote>
+     * <blockquote>
+     * {@code new} {@link #URI(String, String, String, int, String, String, String)
+     * URI}{@code (scheme, null, host, -1, path, null, fragment);}
+     * </blockquote>
      *
      * @param   scheme    Scheme name
      * @param   host      Host name
@@ -784,7 +777,7 @@
     /**
      * Constructs a URI from the given components.
      *
-     * <p> A component may be left undefined by passing <tt>null</tt>.
+     * <p> A component may be left undefined by passing {@code null}.
      *
      * <p> This constructor first builds a URI in string form using the given
      * components as follows:  </p>
@@ -794,14 +787,14 @@
      *   <li><p> Initially, the result string is empty.  </p></li>
      *
      *   <li><p> If a scheme is given then it is appended to the result,
-     *   followed by a colon character (<tt>':'</tt>).  </p></li>
+     *   followed by a colon character ({@code ':'}).  </p></li>
      *
      *   <li><p> If a scheme-specific part is given then it is appended.  Any
      *   character that is not a <a href="#legal-chars">legal URI character</a>
      *   is <a href="#quote">quoted</a>.  </p></li>
      *
      *   <li><p> Finally, if a fragment is given then a hash character
-     *   (<tt>'#'</tt>) is appended to the string, followed by the fragment.
+     *   ({@code '#'}) is appended to the string, followed by the fragment.
      *   Any character that is not a legal URI character is quoted.  </p></li>
      *
      * </ol>
@@ -847,7 +840,7 @@
      * @return The new URI
      *
      * @throws  NullPointerException
-     *          If <tt>str</tt> is <tt>null</tt>
+     *          If {@code str} is {@code null}
      *
      * @throws  IllegalArgumentException
      *          If the given string violates RFC&nbsp;2396
@@ -882,7 +875,7 @@
      * cannot always distinguish a malformed server-based authority from a
      * legitimate registry-based authority.  It must therefore treat some
      * instances of the former as instances of the latter.  The authority
-     * component in the URI string <tt>"//foo:bar"</tt>, for example, is not a
+     * component in the URI string {@code "//foo:bar"}, for example, is not a
      * legal server-based authority but it is legal as a registry-based
      * authority.
      *
@@ -892,7 +885,7 @@
      * treated as an error.  In these cases a statement such as
      *
      * <blockquote>
-     * <tt>URI </tt><i>u</i><tt> = new URI(str).parseServerAuthority();</tt>
+     * {@code URI }<i>u</i>{@code  = new URI(str).parseServerAuthority();}
      * </blockquote>
      *
      * <p> can be used to ensure that <i>u</i> always refers to a URI that, if
@@ -936,26 +929,26 @@
      *
      * <ol>
      *
-     *   <li><p> All <tt>"."</tt> segments are removed. </p></li>
+     *   <li><p> All {@code "."} segments are removed. </p></li>
      *
-     *   <li><p> If a <tt>".."</tt> segment is preceded by a non-<tt>".."</tt>
+     *   <li><p> If a {@code ".."} segment is preceded by a non-{@code ".."}
      *   segment then both of these segments are removed.  This step is
      *   repeated until it is no longer applicable. </p></li>
      *
      *   <li><p> If the path is relative, and if its first segment contains a
-     *   colon character (<tt>':'</tt>), then a <tt>"."</tt> segment is
+     *   colon character ({@code ':'}), then a {@code "."} segment is
      *   prepended.  This prevents a relative URI with a path such as
-     *   <tt>"a:b/c/d"</tt> from later being re-parsed as an opaque URI with a
-     *   scheme of <tt>"a"</tt> and a scheme-specific part of <tt>"b/c/d"</tt>.
+     *   {@code "a:b/c/d"} from later being re-parsed as an opaque URI with a
+     *   scheme of {@code "a"} and a scheme-specific part of {@code "b/c/d"}.
      *   <b><i>(Deviation from RFC&nbsp;2396)</i></b> </p></li>
      *
      * </ol>
      *
-     * <p> A normalized path will begin with one or more <tt>".."</tt> segments
-     * if there were insufficient non-<tt>".."</tt> segments preceding them to
-     * allow their removal.  A normalized path will begin with a <tt>"."</tt>
+     * <p> A normalized path will begin with one or more {@code ".."} segments
+     * if there were insufficient non-{@code ".."} segments preceding them to
+     * allow their removal.  A normalized path will begin with a {@code "."}
      * segment if one was inserted by step 3 above.  Otherwise, a normalized
-     * path will not contain any <tt>"."</tt> or <tt>".."</tt> segments. </p>
+     * path will not contain any {@code "."} or {@code ".."} segments. </p>
      *
      * @return  A URI equivalent to this URI,
      *          but whose path is in normal form
@@ -975,7 +968,7 @@
      * query components are undefined, then a URI with the given fragment but
      * with all other components equal to those of this URI is returned.  This
      * allows a URI representing a standalone fragment reference, such as
-     * <tt>"#foo"</tt>, to be usefully resolved against a base URI.
+     * {@code "#foo"}, to be usefully resolved against a base URI.
      *
      * <p> Otherwise this method constructs a new hierarchical URI in a manner
      * consistent with <a
@@ -1016,7 +1009,7 @@
      * @return The resulting URI
      *
      * @throws  NullPointerException
-     *          If <tt>uri</tt> is <tt>null</tt>
+     *          If {@code uri} is {@code null}
      */
     public URI resolve(URI uri) {
         return resolve(this, uri);
@@ -1027,14 +1020,14 @@
      * against this URI.
      *
      * <p> This convenience method works as if invoking it were equivalent to
-     * evaluating the expression <tt>{@link #resolve(java.net.URI)
-     * resolve}(URI.{@link #create(String) create}(str))</tt>. </p>
+     * evaluating the expression {@link #resolve(java.net.URI)
+     * resolve}{@code (URI.}{@link #create(String) create}{@code (str))}. </p>
      *
      * @param  str   The string to be parsed into a URI
      * @return The resulting URI
      *
      * @throws  NullPointerException
-     *          If <tt>str</tt> is <tt>null</tt>
+     *          If {@code str} is {@code null}
      *
      * @throws  IllegalArgumentException
      *          If the given string violates RFC&nbsp;2396
@@ -1067,7 +1060,7 @@
      * @return The resulting URI
      *
      * @throws  NullPointerException
-     *          If <tt>uri</tt> is <tt>null</tt>
+     *          If {@code uri} is {@code null}
      */
     public URI relativize(URI uri) {
         return relativize(this, uri);
@@ -1077,7 +1070,7 @@
      * Constructs a URL from this URI.
      *
      * <p> This convenience method works as if invoking it were equivalent to
-     * evaluating the expression <tt>new&nbsp;URL(this.toString())</tt> after
+     * evaluating the expression {@code new URL(this.toString())} after
      * first checking that this URI is absolute. </p>
      *
      * @return  A URL constructed from this URI
@@ -1102,14 +1095,14 @@
      * Returns the scheme component of this URI.
      *
      * <p> The scheme component of a URI, if defined, only contains characters
-     * in the <i>alphanum</i> category and in the string <tt>"-.+"</tt>.  A
+     * in the <i>alphanum</i> category and in the string {@code "-.+"}.  A
      * scheme always starts with an <i>alpha</i> character. <p>
      *
      * The scheme component of a URI cannot contain escaped octets, hence this
      * method does not perform any decoding.
      *
      * @return  The scheme component of this URI,
-     *          or <tt>null</tt> if the scheme is undefined
+     *          or {@code null} if the scheme is undefined
      */
     public String getScheme() {
         return scheme;
@@ -1120,7 +1113,7 @@
      *
      * <p> A URI is absolute if, and only if, it has a scheme component. </p>
      *
-     * @return  <tt>true</tt> if, and only if, this URI is absolute
+     * @return  {@code true} if, and only if, this URI is absolute
      */
     public boolean isAbsolute() {
         return scheme != null;
@@ -1134,7 +1127,7 @@
      * An opaque URI has a scheme, a scheme-specific part, and possibly
      * a fragment; all other components are undefined. </p>
      *
-     * @return  <tt>true</tt> if, and only if, this URI is opaque
+     * @return  {@code true} if, and only if, this URI is opaque
      */
     public boolean isOpaque() {
         return path == null;
@@ -1148,7 +1141,7 @@
      * characters. </p>
      *
      * @return  The raw scheme-specific part of this URI
-     *          (never <tt>null</tt>)
+     *          (never {@code null})
      */
     public String getRawSchemeSpecificPart() {
         defineSchemeSpecificPart();
@@ -1164,7 +1157,7 @@
      * href="#decode">decoded</a>.  </p>
      *
      * @return  The decoded scheme-specific part of this URI
-     *          (never <tt>null</tt>)
+     *          (never {@code null})
      */
     public String getSchemeSpecificPart() {
         if (decodedSchemeSpecificPart == null)
@@ -1176,14 +1169,14 @@
      * Returns the raw authority component of this URI.
      *
      * <p> The authority component of a URI, if defined, only contains the
-     * commercial-at character (<tt>'@'</tt>) and characters in the
+     * commercial-at character ({@code '@'}) and characters in the
      * <i>unreserved</i>, <i>punct</i>, <i>escaped</i>, and <i>other</i>
      * categories.  If the authority is server-based then it is further
      * constrained to have valid user-information, host, and port
      * components. </p>
      *
      * @return  The raw authority component of this URI,
-     *          or <tt>null</tt> if the authority is undefined
+     *          or {@code null} if the authority is undefined
      */
     public String getRawAuthority() {
         return authority;
@@ -1197,7 +1190,7 @@
      * sequences of escaped octets are <a href="#decode">decoded</a>.  </p>
      *
      * @return  The decoded authority component of this URI,
-     *          or <tt>null</tt> if the authority is undefined
+     *          or {@code null} if the authority is undefined
      */
     public String getAuthority() {
         if (decodedAuthority == null)
@@ -1213,7 +1206,7 @@
      * <i>other</i> categories. </p>
      *
      * @return  The raw user-information component of this URI,
-     *          or <tt>null</tt> if the user information is undefined
+     *          or {@code null} if the user information is undefined
      */
     public String getRawUserInfo() {
         return userInfo;
@@ -1227,7 +1220,7 @@
      * sequences of escaped octets are <a href="#decode">decoded</a>.  </p>
      *
      * @return  The decoded user-information component of this URI,
-     *          or <tt>null</tt> if the user information is undefined
+     *          or {@code null} if the user information is undefined
      */
     public String getUserInfo() {
         if ((decodedUserInfo == null) && (userInfo != null))
@@ -1244,21 +1237,21 @@
      * <ul>
      *
      *   <li><p> A domain name consisting of one or more <i>labels</i>
-     *   separated by period characters (<tt>'.'</tt>), optionally followed by
+     *   separated by period characters ({@code '.'}), optionally followed by
      *   a period character.  Each label consists of <i>alphanum</i> characters
-     *   as well as hyphen characters (<tt>'-'</tt>), though hyphens never
+     *   as well as hyphen characters ({@code '-'}), though hyphens never
      *   occur as the first or last characters in a label. The rightmost
      *   label of a domain name consisting of two or more labels, begins
      *   with an <i>alpha</i> character. </li>
      *
      *   <li><p> A dotted-quad IPv4 address of the form
-     *   <i>digit</i><tt>+.</tt><i>digit</i><tt>+.</tt><i>digit</i><tt>+.</tt><i>digit</i><tt>+</tt>,
+     *   <i>digit</i>{@code +.}<i>digit</i>{@code +.}<i>digit</i>{@code +.}<i>digit</i>{@code +},
      *   where no <i>digit</i> sequence is longer than three characters and no
      *   sequence has a value larger than 255. </p></li>
      *
-     *   <li><p> An IPv6 address enclosed in square brackets (<tt>'['</tt> and
-     *   <tt>']'</tt>) and consisting of hexadecimal digits, colon characters
-     *   (<tt>':'</tt>), and possibly an embedded IPv4 address.  The full
+     *   <li><p> An IPv6 address enclosed in square brackets ({@code '['} and
+     *   {@code ']'}) and consisting of hexadecimal digits, colon characters
+     *   ({@code ':'}), and possibly an embedded IPv4 address.  The full
      *   syntax of IPv6 addresses is specified in <a
      *   href="http://www.ietf.org/rfc/rfc2373.txt"><i>RFC&nbsp;2373: IPv6
      *   Addressing Architecture</i></a>.  </p></li>
@@ -1269,7 +1262,7 @@
      * method does not perform any decoding.
      *
      * @return  The host component of this URI,
-     *          or <tt>null</tt> if the host is undefined
+     *          or {@code null} if the host is undefined
      */
     public String getHost() {
         return host;
@@ -1282,7 +1275,7 @@
      * integer. </p>
      *
      * @return  The port component of this URI,
-     *          or <tt>-1</tt> if the port is undefined
+     *          or {@code -1} if the port is undefined
      */
     public int getPort() {
         return port;
@@ -1292,12 +1285,12 @@
      * Returns the raw path component of this URI.
      *
      * <p> The path component of a URI, if defined, only contains the slash
-     * character (<tt>'/'</tt>), the commercial-at character (<tt>'@'</tt>),
+     * character ({@code '/'}), the commercial-at character ({@code '@'}),
      * and characters in the <i>unreserved</i>, <i>punct</i>, <i>escaped</i>,
      * and <i>other</i> categories. </p>
      *
      * @return  The path component of this URI,
-     *          or <tt>null</tt> if the path is undefined
+     *          or {@code null} if the path is undefined
      */
     public String getRawPath() {
         return path;
@@ -1311,7 +1304,7 @@
      * escaped octets are <a href="#decode">decoded</a>.  </p>
      *
      * @return  The decoded path component of this URI,
-     *          or <tt>null</tt> if the path is undefined
+     *          or {@code null} if the path is undefined
      */
     public String getPath() {
         if ((decodedPath == null) && (path != null))
@@ -1326,7 +1319,7 @@
      * characters. </p>
      *
      * @return  The raw query component of this URI,
-     *          or <tt>null</tt> if the query is undefined
+     *          or {@code null} if the query is undefined
      */
     public String getRawQuery() {
         return query;
@@ -1340,7 +1333,7 @@
      * escaped octets are <a href="#decode">decoded</a>.  </p>
      *
      * @return  The decoded query component of this URI,
-     *          or <tt>null</tt> if the query is undefined
+     *          or {@code null} if the query is undefined
      */
     public String getQuery() {
         if ((decodedQuery == null) && (query != null))
@@ -1355,7 +1348,7 @@
      * characters. </p>
      *
      * @return  The raw fragment component of this URI,
-     *          or <tt>null</tt> if the fragment is undefined
+     *          or {@code null} if the fragment is undefined
      */
     public String getRawFragment() {
         return fragment;
@@ -1369,7 +1362,7 @@
      * sequences of escaped octets are <a href="#decode">decoded</a>.  </p>
      *
      * @return  The decoded fragment component of this URI,
-     *          or <tt>null</tt> if the fragment is undefined
+     *          or {@code null} if the fragment is undefined
      */
     public String getFragment() {
         if ((decodedFragment == null) && (fragment != null))
@@ -1384,7 +1377,7 @@
      * Tests this URI for equality with another object.
      *
      * <p> If the given object is not a URI then this method immediately
-     * returns <tt>false</tt>.
+     * returns {@code false}.
      *
      * <p> For two URIs to be considered equal requires that either both are
      * opaque or both are hierarchical.  Their schemes must either both be
@@ -1414,7 +1407,7 @@
      *
      * @param   ob   The object to which this object is to be compared
      *
-     * @return  <tt>true</tt> if, and only if, the given object is a URI that
+     * @return  {@code true} if, and only if, the given object is a URI that
      *          is identical to this URI
      */
     public boolean equals(Object ob) {
@@ -1635,7 +1628,7 @@
     /**
      * Saves the content of this URI to the given serial stream.
      *
-     * <p> The only serializable field of a URI instance is its <tt>string</tt>
+     * <p> The only serializable field of a URI instance is its {@code string}
      * field.  That field is given a value, if it does not have one already,
      * and then the {@link java.io.ObjectOutputStream#defaultWriteObject()}
      * method of the given object-output stream is invoked. </p>
@@ -1654,7 +1647,7 @@
      * Reconstitutes a URI from the given serial stream.
      *
      * <p> The {@link java.io.ObjectInputStream#defaultReadObject()} method is
-     * invoked to read the value of the <tt>string</tt> field.  The result is
+     * invoked to read the value of the {@code string} field.  The result is
      * then parsed in the usual way.
      *
      * @param  is  The object-input stream from which this object