Java URI Create createURI(String uri)

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

Description

create URI

License

Apache License

Declaration

public static final URI createURI(String uri) 

Method Source Code

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

import java.net.URI;

public class Main {
    public static final URI createURI(String uri) {
        return URI.create("//" + parseCorrectURI(uri));
    }//from  w  ww . jav  a 2 s.  co  m

    private static final String parseCorrectURI(String uri) {
        String[] parts = uri.split(":");

        if (parts.length - 1 >= 3) {
            String port = parts[parts.length - 1];
            uri = "[" + uri.replace(":" + port, "") + "]:" + port;
        }
        return uri;
    }
}

Related

  1. createURI(String spec)
  2. createUri(String sUri, String defaultSchema, int deafultPort)
  3. createUri(String u)
  4. createUri(String uri)
  5. createURI(String uri)
  6. createURI(String uri)
  7. createURIWithFull(final String scheme, final String userInfo, final String host, final int port, final String path, final String query, final String fragment)
  8. getUri()
  9. getUri(File file)