Java URI from toURIObject(String uri)

Here you can find the source of toURIObject(String uri)

Description

to URI Object

License

Open Source License

Declaration

public static URI toURIObject(String uri) throws IOException 

Method Source Code

//package com.java2s;
/**//from  w w w . j a  va 2 s . c  o m
 * This class holds various utility methods.
 * 
 * @author Yanick Duchesne
 *         <dl>
 *         <dt><b>Copyright: </b>
 *         <dd>Copyright &#169; 2002-2007 <a
 *         href="http://www.sapia-oss.org">Sapia Open Source Software </a>. All
 *         Rights Reserved.</dd>
 *         </dt>
 *         <dt><b>License: </b>
 *         <dd>Read the license.txt file of the jar or visit the <a
 *         href="http://www.sapia-oss.org/license.html">license page </a> at the
 *         Sapia OSS web site</dd>
 *         </dt>
 *         </dl>
 */

import java.io.IOException;

import java.net.URI;
import java.net.URISyntaxException;

public class Main {
    public static URI toURIObject(String uri) throws IOException {
        try {
            return new URI(uri);
        } catch (URISyntaxException e) {
            throw new IOException("Could not parse uri: " + uri + " - " + e.getMessage());
        }
    }
}

Related

  1. toURI(String uri)
  2. toUri(String uri)
  3. toURI(URI parent, String child)
  4. toURIArray(String[] array)
  5. toURIList(Collection stringList)
  6. toURIs(File... files)
  7. toURIs(Iterable files)
  8. toURIs(String[] filePaths)
  9. toUriString(File file)