Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

A Uniform Resource Identifier (URI) contains a string of characters used to identify a resource; this is a more general concept than an URL. The java.net.URI class provides string-based equals() and hashCode() methods that satisfy the general contracts for Object.equals() and Object.hashCode(); they do not invoke hostname resolution and are unaffected by network connectivity. URI also provides methods for normalization and canonicalization that URL lacks. Finally, the URL.toURI() and URI.toURL() methods provide easy conversion between the two classes. Programs should use URIs instead of URLs whenever possible. According to the Java API Class URI documentation [API 2014]:

...

Additionally, the URI class performs normalization (removing extraneous path segments such as '"..'") and relativization of paths [API 2014], [Darwin 2004].

...