Java URI Value Check isFileUri(String uri)

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

Description

is File Uri

License

Apache License

Declaration

public static boolean isFileUri(String uri) throws URISyntaxException 

Method Source Code

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

import java.net.URI;
import java.net.URISyntaxException;

public class Main {
    static String FILE = "file";

    public static boolean isFileUri(String uri) throws URISyntaxException {
        String scheme = (new URI(uri)).getScheme();

        if (scheme != null)
            return scheme.toLowerCase().equals(FILE);

        return false;
    }//ww  w  . j  a va 2s .  c  o m

    public static String getScheme(String uri) throws URISyntaxException {
        String scheme = (new URI(uri)).getScheme();

        if (scheme != null)
            return scheme.toLowerCase();

        return null;
    }
}

Related

  1. isExtensionUri(final URI uri)
  2. isFile(final URI uri)
  3. isFile(URI uri)
  4. isFile(URI uri)
  5. isFileSystemAvailable(File file, URI topLevelResource)
  6. isFileURI(URI uri)
  7. isFileURI(URI uri)
  8. isFileUri(URI uri)
  9. isFtp(URI uri)