Java URI Value Check isValid(URI uri)

Here you can find the source of isValid(URI uri)

Description

is Valid

License

Apache License

Declaration

public static boolean isValid(URI uri) 

Method Source Code


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

import java.net.URI;

public class Main {
    public static boolean isValid(URI uri) {
        if (isEmpty(uri.getScheme()) || isEmpty(uri.getHost()) || uri.getPort() == -1) {
            return false;
        }/*from  www  .  j  a  v  a2s .c  o m*/

        return true;
    }

    private static boolean isEmpty(String value) {
        return value == null || value.trim().length() == 0;
    }
}

Related

  1. isURI(String plainString)
  2. isURI(String uri)
  3. isUriValid(String uri)
  4. isUsingNonDefaultPort(URI uri)
  5. isValid(String uri)
  6. isValidURI(final String namespace)
  7. isValidURI(String uri)
  8. isValidUri(String uri, StringBuilder errMsg)
  9. isValidUri(String uriCandidate)