diff options
author | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2005-04-20 05:34:29 +0000 |
---|---|---|
committer | Michael Koch <mkoch@gcc.gnu.org> | 2005-04-20 05:34:29 +0000 |
commit | 1701deb20b24ba922ac690b5af8a7d2360ca3530 (patch) | |
tree | 6ea2243a88838c45ae0e9d00fbb4feac1cc6f054 /libjava/java/net/URL.java | |
parent | f12b785df384d2ffc150cd2f9b449aa4d8a54834 (diff) | |
download | gcc-1701deb20b24ba922ac690b5af8a7d2360ca3530.zip gcc-1701deb20b24ba922ac690b5af8a7d2360ca3530.tar.gz gcc-1701deb20b24ba922ac690b5af8a7d2360ca3530.tar.bz2 |
2005-04-20 Andrew John Hughes <gnu_andrew@member.fsf.org>
* java/net/URL.java:
(toURI()): Implemented.
From-SVN: r98437
Diffstat (limited to 'libjava/java/net/URL.java')
-rw-r--r-- | libjava/java/net/URL.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/libjava/java/net/URL.java b/libjava/java/net/URL.java index ec86766..7eb68cb 100644 --- a/libjava/java/net/URL.java +++ b/libjava/java/net/URL.java @@ -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()); + } + } |