2005-04-20 Andrew John Hughes <gnu_andrew@member.fsf.org>

* java/net/URL.java:
	(toURI()): Implemented.

From-SVN: r98437
This commit is contained in:
Andrew John Hughes 2005-04-20 05:34:29 +00:00 committed by Michael Koch
parent f12b785df3
commit 1701deb20b
2 changed files with 22 additions and 0 deletions

View file

@ -953,4 +953,21 @@ public final class URL implements Serializable
{
oos.defaultWriteObject();
}
/**
* Returns the equivalent <code>URI</code> object for this <code>URL</code>.
* This is the same as calling <code>new URI(this.toString())</code>.
* RFC2396-compliant URLs are guaranteed a successful conversion to
* a <code>URI</code> 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());
}
}