Java Utililty Methods URI Value Check

List of utility methods to do URI Value Check

Description

The list of methods to do URI Value Check are organized into topic(s).

Method

booleanisResourceLocalToServer(URI resourceUri, URI serverUri)
Figure out whether the URI is actually local to the server.
URI relativeUri = serverUri.relativize(resourceUri);
return !relativeUri.isAbsolute();
booleanisRoot(URI base)
is Root
String path = base.getPath();
return "/".equals(path) || path.isEmpty();
booleanisRoot(URI uri)
is Root
try {
    return parseParentURI(uri) == null ? true : false;
} catch (Exception e) {
    throw new RuntimeException();
booleanisSecure(final URI uri)
is Secure
final String scheme = uri.getScheme();
return ("https".equals(scheme) || "wss".equals(scheme));
booleanisSecure(URI uri)
Check if given URI is "secure", i.e.
return uri != null && uri.getScheme().equalsIgnoreCase("https");
booleanisShortTcpURI(URI resource)
is Short Tcp URI
return resource != null && "tcp".equals(resource.getScheme()) && resource.getHost() != null
        && resource.getHost().length() <= 256;
booleanisSystemIdentifier(URI localIdentifier)
is System Identifier
return localIdentifier.normalize().toString().equals(LOCAL_SYSTEM_IDENTIFIER.normalize().toString());
booleanisType(URI uri, Class clazz)
is Type
String simpleName = clazz.getSimpleName();
return uri.toString().startsWith("urn:storageos:" + simpleName);
booleanisType(URI uri, String name)
is Type
return uri.toString().startsWith("urn:storageos:" + name);
booleanisURI(Class type)
is URI
return type.isAssignableFrom(URI.class);