Java URI from toURI(String uri)

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

Description

Converts a string to a URI without a URISyntaxException

License

Apache License

Parameter

Parameter Description
uri The URI string to convert.

Return

A new URI object.

Declaration

static final URI toURI(String uri) 

Method Source Code


//package com.java2s;
// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *

import java.net.*;

public class Main {
    /**//from  w  w  w .  j av a  2s . c  o m
     * Converts a string to a URI without a {@link URISyntaxException}
     *
     * @param uri The URI string to convert.
     * @return A new URI object.
     */
    static final URI toURI(String uri) {
        try {
            return new URI(uri);
        } catch (URISyntaxException e) {
            throw new RuntimeException(e);
        }
    }
}

Related

  1. toURI(String str)
  2. toURI(String str)
  3. toURI(String sUri)
  4. toURI(String uri)
  5. toUri(String uri)
  6. toURI(URI parent, String child)
  7. toURIArray(String[] array)
  8. toURIList(Collection stringList)
  9. toURIObject(String uri)