2005-04-20 Andrew John Hughes <gnu_andrew@member.fsf.org>
authorAndrew John Hughes <gnu_andrew@member.fsf.org>
Wed, 20 Apr 2005 05:34:29 +0000 (05:34 +0000)
committerMichael Koch <mkoch@gcc.gnu.org>
Wed, 20 Apr 2005 05:34:29 +0000 (05:34 +0000)
* java/net/URL.java:
(toURI()): Implemented.

From-SVN: r98437

libjava/ChangeLog
libjava/java/net/URL.java

index 5c5ca3f486e821c2976f4be603e14aaae6a4101c..109791be76c102142e80404043ec7e154e75c564 100644 (file)
@@ -1,3 +1,8 @@
+2005-04-20  Andrew John Hughes  <gnu_andrew@member.fsf.org>
+
+       * java/net/URL.java:
+       (toURI()): Implemented.
+
 2005-04-19  Michael Koch  <konqueror@gmx.de>
 
        * java/net/InetAddress.java
index ec86766ba3700d760385bfdb44c1dc205fca779c..7eb68cb3f0754957f70194e80acd8c03f02645fd 100644 (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());
+  }
+
 }