List of utility methods to do Is Relative Path
boolean | isRelative(File target_) is Relative if (target_ == null) return false; String path = target_.getPath(); if (path == null) return false; return path.startsWith("."); |
boolean | isRelative(final String path) Determine whether a path name is relative. return path.isEmpty() || !isSeparator(path.charAt(0));
|
boolean | isRelative(String path) A simple way to check if the path is relative o absolute if (path.indexOf(File.separator) >= 0) { return false; return true; |
boolean | isRelativePath(final String filePath) is Relative Path final int filePathLength = filePath.length(); return !((filePathLength >= 1 && File.separatorChar == '/' && filePath.charAt(0) == '/') || (filePathLength >= 2 && File.separatorChar == '\\' && filePath.charAt(1) == ':')); |
boolean | isRelativePath(String candidatePath) Determines if the supplied volume binding path contains a relative path. if (candidatePath.startsWith(UNIX_SEP) || candidatePath.startsWith(WINDOWS_SEP) || WINDOWS_DRIVE_PATTERN.matcher(candidatePath).matches()) { return false; if (candidatePath.startsWith(DOT + RUNTIME_SEP) || candidatePath.startsWith(DOT + DOT + RUNTIME_SEP)) { return true; if (candidatePath.contains(UNIX_SEP) || candidatePath.contains(WINDOWS_SEP)) { ... |
boolean | isRelativePath(String fileName) Checks if a given file name contains relative path. if (fileName == null || fileName.indexOf(':') > 0 || fileName.startsWith("\\\\")) return false; if (File.separatorChar == '/') { return !fileName.startsWith(File.separator); } else if (File.separatorChar == '\\') { File file = new File(fileName); ... |
boolean | isRelativePath(String path) Indicates whether the provided path refers to a relative path rather than an absolute path. File f = new File(path); return !f.isAbsolute(); |
boolean | isRelativePath(String path) is Relative Path if (path == null) { return false; } else { return !new File(path).isAbsolute(); |
boolean | isRelativePath(String path) Is the given path relative if (path.startsWith("http:") || path.startsWith("ftp:") || path.startsWith("/") || path.startsWith(File.separator)) { return false; if (path.substring(1, 2).equals(":")) { return false; return true; ... |
boolean | isRelativePath(String path) is Relative Path String osName = System.getProperty("os.name"); if (osName.toLowerCase().startsWith("linux")) { if (path.startsWith(File.separator)) { return false; } else { return true; } else if (osName.toLowerCase().startsWith("windows")) { ... |