Java URI Value Check isDirectory(URI orig)

Here you can find the source of isDirectory(URI orig)

Description

If there is a directory at the other end of this URI return true.

License

Open Source License

Parameter

Parameter Description
orig The URI to check

Return

true if the URI points at a file: directory

Declaration

public static boolean isDirectory(URI orig) 

Method Source Code

//package com.java2s;
/**/*  ww  w .  j a v a  2  s. c  o m*/
 * Distribution License:
 * JSword is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License, version 2.1 as published by
 * the Free Software Foundation. This program is distributed in the hope
 * that it will be useful, but WITHOUT ANY WARRANTY; without even the
 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Lesser General Public License for more details.
 *
 * The License is available on the internet at:
 *       http://www.gnu.org/copyleft/lgpl.html
 * or by writing to:
 *      Free Software Foundation, Inc.
 *      59 Temple Place - Suite 330
 *      Boston, MA 02111-1307, USA
 *
 * Copyright: 2005
 *     The copyright to this program is held by it's authors.
 *
 * ID: $Id$
 */

import java.io.File;

import java.net.URI;

public class Main {
    /**
     * Constant for the file: protocol or scheme
     */
    public static final String PROTOCOL_FILE = "file";

    /**
     * If there is a directory at the other end of this URI return true. Note
     * non file: type URI will always return false
     * 
     * @param orig
     *            The URI to check
     * @return true if the URI points at a file: directory
     */
    public static boolean isDirectory(URI orig) {
        if (!orig.getScheme().equals(PROTOCOL_FILE)) {
            return false;
        }

        return new File(orig.getPath()).isDirectory();
    }
}

Related

  1. isAnyAddress(final URI u)
  2. isAvailable(URI address)
  3. isBagUri(final URI uri)
  4. isBase(URI base, URI uri)
  5. isDefaultPort(URI uri)
  6. isExtensionUri(final URI uri)
  7. isFile(final URI uri)
  8. isFile(URI uri)
  9. isFile(URI uri)