List of utility methods to do Is Legal File Path
boolean | isLegalDir(final String dirname) Proves if the argument points to a existent directory (not file!). final File f = new File(dirname); if (!f.exists()) { return false; if (f.isFile()) { return false; return true; ... |
boolean | isLegalFile(String filePath) is Legal File File file = new File(filePath); if (!file.exists() || file.isDirectory() || !file.canRead()) { return false; return true; |
boolean | isLegalFilePath(File inBasePath, File inResourcePath) check if the resource path is a subpath of the basepath try { return inResourcePath.getCanonicalPath().startsWith(inBasePath.getCanonicalPath()); } catch (final Exception e) { return false; |