Java URI Value Check isURI(String plainString)

Here you can find the source of isURI(String plainString)

Description

is URI

License

Open Source License

Declaration

public static boolean isURI(String plainString) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;

public class Main {
    public static boolean isURI(String plainString) {
        try {/*from www.  ja v a2  s  .  c o m*/
            URL url = new URL(plainString);
            URI uri = new URI(url.getProtocol(), url.getUserInfo(), url.getHost(), url.getPort(), url.getPath(),
                    url.getQuery(), url.getRef());
            return true;
        } catch (URISyntaxException | MalformedURLException e) {
            return false;
        }
    }
}

Related

  1. isShortTcpURI(URI resource)
  2. isSystemIdentifier(URI localIdentifier)
  3. isType(URI uri, Class clazz)
  4. isType(URI uri, String name)
  5. isURI(Class type)
  6. isURI(String uri)
  7. isUriValid(String uri)
  8. isUsingNonDefaultPort(URI uri)
  9. isValid(String uri)