Java URI Create createURI(String scheme, String host, String path)

Here you can find the source of createURI(String scheme, String host, String path)

Description

create URI

License

Apache License

Declaration

public static URI createURI(String scheme, String host, String path) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.net.URI;

public class Main {
    public static URI createURI(String scheme, String host, String path) {
        String uri = scheme + "://" + host + path;
        return createURI(uri);
    }//from   ww w .  j  ava 2s . c  om

    public static URI createURI(String uri) {
        if (uri.endsWith("/") && uri.length() > 1) {
            uri = uri.substring(0, uri.length() - 1);
        }
        try {
            return new URI(uri);
        } catch (Exception e) {
            throw new IllegalArgumentException("Invalid uri - " + uri);
        }
    }
}

Related

  1. createURI(String filename)
  2. createURI(String hostname, int port)
  3. createUri(String name, Kind kind)
  4. createURI(String path)
  5. createURI(String path)
  6. createURI(String spec)
  7. createUri(String sUri, String defaultSchema, int deafultPort)
  8. createUri(String u)
  9. createUri(String uri)