Java Utililty Methods Is Relative Path

List of utility methods to do Is Relative Path

Description

The list of methods to do Is Relative Path are organized into topic(s).

Method

booleanisRelative(File target_)
is Relative
if (target_ == null)
    return false;
String path = target_.getPath();
if (path == null)
    return false;
return path.startsWith(".");
booleanisRelative(final String path)
Determine whether a path name is relative.
return path.isEmpty() || !isSeparator(path.charAt(0));
booleanisRelative(String path)
A simple way to check if the path is relative o absolute
if (path.indexOf(File.separator) >= 0) {
    return false;
return true;
booleanisRelativePath(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) == ':'));
booleanisRelativePath(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)) {
...
booleanisRelativePath(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);
...
booleanisRelativePath(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();
booleanisRelativePath(String path)
is Relative Path
if (path == null) {
    return false;
} else {
    return !new File(path).isAbsolute();
booleanisRelativePath(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;
...
booleanisRelativePath(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")) {
...