Java Is Symbolic Link isSymlink(File file)

Here you can find the source of isSymlink(File file)

Description

is Symlink

License

Apache License

Declaration

public static boolean isSymlink(File file) throws IOException 

Method Source Code

//package com.java2s;
// (as allowed under the Apache License 2.0)

import java.io.File;

import java.io.IOException;

public class Main {
    public static boolean isSymlink(File file) throws IOException {
        if (file == null)
            throw new NullPointerException("File must not be null");
        File canon;//from w  ww  . j  a v  a  2s.c o m
        if (file.getParent() == null) {
            canon = file;
        } else {
            File canonDir = file.getParentFile().getCanonicalFile();
            canon = new File(canonDir, file.getName());
        }
        return !canon.getCanonicalFile().equals(canon.getAbsoluteFile());
    }
}

Related

  1. isSymlink(File file)
  2. isSymlink(File file)
  3. isSymlink(File file)
  4. isSymlink(File file)
  5. isSymlink(File file)
  6. isSymlink(File file)
  7. isSymlink(File file)
  8. isSymLink(File symlinkFile)
  9. isSymlink(final File file)