Java File Link isLink(File f)

Here you can find the source of isLink(File f)

Description

is Link

License

GNU General Public License

Declaration

public static boolean isLink(File f) throws IOException 

Method Source Code


//package com.java2s;
/* Original source code (c) 2013 C. Ivan Cooper. Licensed under GPLv3, see file COPYING for terms. */

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

import java.nio.file.Files;
import java.nio.file.Paths;

public class Main {
    public static boolean isLink(File f) throws IOException {
        return Files.isSymbolicLink(Paths.get(f.getPath()));

        /*        if (f.getName().toUpperCase().endsWith(".LNK"))
        return true;/*from w  ww. j  a va2s . c o  m*/
            return ! (f.getAbsolutePath().equals(f.getCanonicalPath()));*/
        // this doesn't seem to work on relative paths
    }
}

Related

  1. createRelativeSymlink(File link, File target, boolean relativize)
  2. createSymbolicLink(@Nonnull File symlink, File target)
  3. createSymbolicLink(File pTargetFile, File pLink)
  4. followLinks(LinkOption... options)
  5. getLinkOptions(boolean followLinks)
  6. isSymbolicLink(File file)
  7. isSymbolicLink(String file)
  8. isSymlink(File file)
  9. isSymLink(File file)