Here you can find the source of isFileUrl(URL url)
file
.
public static boolean isFileUrl(URL url)
//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()); } }