Java URI Value Check isFile(final URI uri)

Here you can find the source of isFile(final URI uri)

Description

Is the URI representing a file??

License

Open Source License

Parameter

Parameter Description
uri the URI to process

Return

true if the URI is representing a file, false otherwise

Declaration

public static boolean isFile(final URI uri) 

Method Source Code

//package com.java2s;
/*//from  www . j a  v a  2 s  .co m
 * Copyright (c) 2014 Stephan D. Cote' - All rights reserved.
 * 
 * This program and the accompanying materials are made available under the 
 * terms of the MIT License which accompanies this distribution, and is 
 * available at http://creativecommons.org/licenses/MIT/
 *
 * Contributors:
 *   Stephan D. Cote 
 *      - Initial concept and implementation
 */

import java.net.URI;

public class Main {
    /**
     * Is the URI representing a file??
     *
     * @param uri the URI to process
     * 
     * @return true if the URI is representing a file, false otherwise
     */
    public static boolean isFile(final URI uri) {
        if ((uri != null) && (uri.getScheme() != null)) {
            return uri.getScheme().equalsIgnoreCase("file");
        }

        return false;
    }
}

Related

  1. isBagUri(final URI uri)
  2. isBase(URI base, URI uri)
  3. isDefaultPort(URI uri)
  4. isDirectory(URI orig)
  5. isExtensionUri(final URI uri)
  6. isFile(final URI uri)
  7. isFile(URI uri)
  8. isFile(URI uri)
  9. isFileSystemAvailable(File file, URI topLevelResource)