Index: java/net/URL.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/net/URL.java,v retrieving revision 1.44 diff -u -3 -p -u -r1.44 URL.java --- java/net/URL.java 28 Mar 2005 23:59:20 -0000 1.44 +++ java/net/URL.java 19 Apr 2005 00:29:25 -0000 @@ -935,4 +935,21 @@ public final class URL implements Serial { oos.defaultWriteObject(); } + + /** + * Returns the equivalent URI object for this URL. + * This is the same as calling new URI(this.toString()). + * RFC2396-compliant URLs are guaranteed a successful conversion to + * a URI instance. However, there are some values which + * form valid URLs, but which do not also form RFC2396-compliant URIs. + * + * @throws URISyntaxException if this URL is not RFC2396-compliant, + * and thus can not be successfully converted to a URI. + */ + public URI toURI() + throws URISyntaxException + { + return new URI(toString()); + } + }