Here you can find the source of isUrlFile(String filePath)
Parameter | Description |
---|---|
filePath | a parameter |
public static boolean isUrlFile(String filePath)
//package com.java2s; //License from project: Open Source License import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { /**/* w w w . ja v a2s.c o m*/ * check if it is a Url * * @param filePath * @return Url name if it is a url otherwise null */ public static boolean isUrlFile(String filePath) { String urlPattern = "((https?|ftp):((//)|(\\\\))+[\\w\\d:#@%/;$()~_?\\+-=\\\\\\.&]*)"; Pattern p = Pattern.compile(urlPattern, Pattern.CASE_INSENSITIVE); Matcher m = p.matcher(filePath); if (m.find()) { return true; } return false; } }