From: Andrew John Hughes Date: Wed, 20 Apr 2005 05:34:29 +0000 (+0000) Subject: 2005-04-20 Andrew John Hughes X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1701deb20b24ba922ac690b5af8a7d2360ca3530;p=platform%2Fupstream%2Fgcc.git 2005-04-20 Andrew John Hughes * java/net/URL.java: (toURI()): Implemented. From-SVN: r98437 --- diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 5c5ca3f..109791b 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,8 @@ +2005-04-20 Andrew John Hughes + + * java/net/URL.java: + (toURI()): Implemented. + 2005-04-19 Michael Koch * java/net/InetAddress.java 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 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()); + } + }