Java Is Symbolic Link isSymlink(File file)

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

Description

is Symlink

License

Apache License

Declaration

private static boolean isSymlink(File file) throws IOException 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import com.google.common.base.Preconditions;

import java.io.File;
import java.io.IOException;

public class Main {
    private static boolean isSymlink(File file) throws IOException {
        Preconditions.checkNotNull(file);
        File fileInCanonicalDir = null;
        if (file.getParent() == null) {
            fileInCanonicalDir = file;/*ww  w.  java2s.  com*/
        } else {
            fileInCanonicalDir = new File(file.getParentFile().getCanonicalFile(), file.getName());
        }
        return !fileInCanonicalDir.getCanonicalFile().equals(fileInCanonicalDir.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 symlinkFile)
  7. isSymlink(final File file)
  8. isSymlink(final String path)