Here you can find the source of isLocalFile(URL url)
public static boolean isLocalFile(URL url)
//package com.java2s; //License from project: LGPL import java.io.File; import java.net.URI; import java.net.URL; public class Main { private static final String FILE_SCHEME = "file"; public static boolean isLocalFile(URL url) { try {//from w w w .j a v a 2 s . c om if (url.getProtocol().equals( new File(url.getFile()).toURI().toURL().getProtocol())) { return true; } } catch (Throwable throwable) { throwable.printStackTrace(); } return false; } public static boolean isLocalFile(URI uri) { try { if (uri.isAbsolute() && !uri.isOpaque() && FILE_SCHEME.equals(uri.getScheme())) { return true; } } catch (Throwable throwable) { throwable.printStackTrace(); } return false; } }