List of utility methods to do Path Check
File | getUserCurrentDir() get User Current Dir return new File(System.getProperty(SYS_PROP_USER_CURRENT_DIR)); |
boolean | isAbsolutePath(String path) Determines if the path specified by a given String is an absolute path or not. if (StringUtil.nullOrEmptyOrBlankString(path)) { return false; if (SystemUtil.isWin32()) { int indexToSearch = path.indexOf(":") + 1; return (path.startsWith("\\", indexToSearch) || path.startsWith("/", indexToSearch)); return path.startsWith("/"); |
boolean | isLikelyFilePath(String s) Return whether or not the provided string is possibly a valid file path. if (s == null || s.trim().length() == 0) { return false; return Pattern.matches(FILE_PATH_PATTERN, s); |