Java URL Value Check isFileUrl(URL url)

Here you can find the source of isFileUrl(URL url)

Description

Returns true if the specified url is to a file, i.e its protocol is file.

License

Open Source License

Declaration

public static boolean isFileUrl(URL url) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2007, 2009 Oracle. All rights reserved.
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0, which accompanies this distribution
 * and is available at http://www.eclipse.org/legal/epl-v10.html.
 * //from  w  ww .j a v  a2 s .  c o m
 * Contributors:
 *     Oracle - initial API and implementation
 ******************************************************************************/

import java.net.URL;

public class Main {
    /**
     * The <code>file</code> string indicating a url file protocol.
     */
    public static final String FILE_PROTOCOL = "file";

    /**
     * Returns true if the specified url is to a file, i.e its protocol is <code>file</code>.
     */
    public static boolean isFileUrl(URL url) {
        return url != null && FILE_PROTOCOL.equals(url.getProtocol());
    }
}

Related

  1. isFileURL(URL url)
  2. isFileURL(URL url)
  3. isFileURL(URL url)
  4. isFileURL(URL url)
  5. isFileURL(URL url)
  6. isHosting(URL url_in)
  7. isHTTP(URL url)
  8. isHttpOk(String url)
  9. isHttpUrl(final URI toCheck)