Here you can find the source of isLocalFile(URI uri)
Parameter | Description |
---|---|
uri | The URI. May be <code>null</code>. |
true
if the URI represents a local file, otherwise false
.
public static boolean isLocalFile(URI uri)
//package com.java2s; //License from project: Open Source License import java.net.URI; public class Main { public static final String FILE_URI_SCHEME = "file"; /**/*from w ww. j a v a 2 s . co m*/ * Tests to see if a URI represents a local file. * @param uri The URI. May be <code>null</code>. * @return <code>true</code> if the URI represents a local file, otherwise <code>false</code>. */ public static boolean isLocalFile(URI uri) { if (uri == null) { return false; } String scheme = uri.getScheme(); return scheme != null && FILE_URI_SCHEME.equals(scheme.toLowerCase()); } }