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

booleanisFile(final URI uri)
Is the URI representing a file??
if ((uri != null) && (uri.getScheme() != null)) {
    return uri.getScheme().equalsIgnoreCase("file");
return false;
booleanisFile(URI uri)
is File
return "file".equals(uri.getScheme()) || !uri.isAbsolute();
booleanisFile(URI uri)
If there is a file at the other end of this URI return true.
if (uri.getScheme().equals(PROTOCOL_FILE)) {
    return new File(uri.getPath()).isFile();
try {
    uri.toURL().openStream().close();
    return true;
} catch (IOException ex) {
    return false;
...
booleanisFileSystemAvailable(File file, URI topLevelResource)
Determines via best effort if the file system on which the file resides is available.
File topLevel = new File(topLevelResource);
if (isEqualPath(file, topLevel)) {
    return file.exists();
return isFileSystemAvailable(file, topLevel);
booleanisFileUri(String uri)
is File Uri
String scheme = (new URI(uri)).getScheme();
if (scheme != null)
    return scheme.toLowerCase().equals(FILE);
return false;
booleanisFileURI(URI uri)
Returns whether the given URI refers to a local file system URI.
return SCHEME_FILE.equalsIgnoreCase(uri.getScheme());
booleanisFileURI(URI uri)
Returns whether the given uri is a file URI as returned, e.g., by a File.
return null != uri && "file".equals(uri.getScheme());
booleanisFileUri(URI uri)
is File Uri
if (uri == null) {
    return false;
return "file".equals(uri.getScheme());
booleanisFtp(URI uri)
check if URI scheme is ftp
if ("ftp".equals(uri.getScheme())) {
    return true;
return false;
booleanisHostDnsName(URI uri)
Returns a boolean indicating whether the host of the specified URI is DNS.
String host = uri.getHost();
for (int i = 0; i < host.length(); i++) {
    char hostChar = host.charAt(i);
    if (!Character.isDigit(hostChar) && !(hostChar == '.')) {
        return true;
return false;
...