Java Utililty Methods Is Symbolic Link

List of utility methods to do Is Symbolic Link

Description

The list of methods to do Is Symbolic Link are organized into topic(s).

Method

booleanisSymlink(File file)
Checks if the given file represents a symlink.
String name = file.getName();
if (name.equals(".") || name.equals("..")) {
    return false;
File fileInCanonicalParent;
File parentDir = file.getParentFile();
if (parentDir == null) {
    fileInCanonicalParent = file;
...
booleanisSymlink(File file)
is Symlink
Objects.requireNonNull(file, "File must not be null");
if (File.separatorChar == '\\')
    return false;
File fileInCanonicalDir;
if (file.getParent() == null)
    fileInCanonicalDir = file;
else {
    File canonicalDir = file.getParentFile().getCanonicalFile();
...
booleanisSymlink(File file)
is Symlink
if (file == null)
    throw new NullPointerException("File must not be null");
File canon;
if (file.getParent() == null) {
    canon = file;
} else {
    File canonDir = file.getParentFile().getCanonicalFile();
    canon = new File(canonDir, file.getName());
...
booleanisSymlink(File file)
Checks whether a file is a symbolic link.
File parent = file.getParentFile();
File test = new File(parent.getCanonicalFile(), file.getName());
return !test.getAbsolutePath().equals(test.getCanonicalPath());
booleanisSymlink(File file)
is Symlink
Preconditions.checkNotNull(file);
File fileInCanonicalDir = null;
if (file.getParent() == null) {
    fileInCanonicalDir = file;
} else {
    fileInCanonicalDir = new File(file.getParentFile().getCanonicalFile(), file.getName());
return !fileInCanonicalDir.getCanonicalFile().equals(fileInCanonicalDir.getAbsoluteFile());
...
booleanisSymLink(File symlinkFile)
Check if a file is a symbolic link or not
try {
    File canonicalFile = null;
    if (symlinkFile.getParent() != null) {
        File canonicalDir = symlinkFile.getParentFile().getCanonicalFile();
        canonicalFile = new File(canonicalDir, symlinkFile.getName());
    } else {
        canonicalFile = symlinkFile;
    return !canonicalFile.getCanonicalFile().equals(canonicalFile.getAbsoluteFile());
} catch (IOException e) {
    return false;
booleanisSymlink(final File file)
Attempt to determine if a file is a symlink.
return !(file.getAbsolutePath().equals(file.getCanonicalPath()));
booleanisSymlink(final String path)
is Symlink
final File file = new File(path);
final File fileInCanonicalDir;
if (file.getParent() == null) {
    fileInCanonicalDir = file;
} else {
    fileInCanonicalDir = new File(file.getParentFile().getCanonicalFile(), file.getName());
final File canonicalFile = fileInCanonicalDir.getCanonicalFile();
...