Here you can find the source of isLegalFile(String filePath)
public static boolean isLegalFile(String filePath)
//package com.java2s; //License from project: Open Source License import java.io.File; public class Main { public static boolean isLegalFile(String filePath) { File file = new File(filePath); if (!file.exists() || file.isDirectory() || !file.canRead()) { return false; }/*from ww w. ja va2s. c o m*/ return true; } }