Example usage for java.nio.file LinkOption NOFOLLOW_LINKS

List of usage examples for java.nio.file LinkOption NOFOLLOW_LINKS

Introduction

In this page you can find the example usage for java.nio.file LinkOption NOFOLLOW_LINKS.

Prototype

LinkOption NOFOLLOW_LINKS

To view the source code for java.nio.file LinkOption NOFOLLOW_LINKS.

Click Source Link

Document

Do not follow symbolic links.

Usage

From source file:Test.java

public static void main(String[] args) throws Exception {
    Path path = Paths.get("users.txt");

    System.out.println("Real path: " + path.toRealPath(LinkOption.NOFOLLOW_LINKS));
}

From source file:Test.java

public static void main(String[] args) throws Exception {
    Path path = Paths.get("users.txt");

    if (path.toFile().exists()) {
        System.out.println("Real path: " + path.toRealPath(LinkOption.NOFOLLOW_LINKS));
    } else {// w  w w  . j  av  a 2s  .c  o m
        System.out.println("The file does not exist");
    }
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    Path path = FileSystems.getDefault().getPath("/home/docs/users.txt");
    System.out.println(Files.notExists(path, LinkOption.NOFOLLOW_LINKS));
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    Path path = FileSystems.getDefault().getPath("/home/docs/users.txt");
    System.out.println(Files.isDirectory(path, LinkOption.NOFOLLOW_LINKS));
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    Path path = FileSystems.getDefault().getPath("/home/docs/users.txt");
    System.out.println(Files.isRegularFile(path, LinkOption.NOFOLLOW_LINKS));
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    Path path = FileSystems.getDefault().getPath("/home/docs/users.txt");
    System.out.println(Files.getLastModifiedTime(path, LinkOption.NOFOLLOW_LINKS));
}

From source file:Main.java

public static void main(String[] args) {

    Path path = FileSystems.getDefault().getPath("C:/tutorial/Java/JavaFX", "Demo.txt");

    boolean path_exists = Files.exists(path, new LinkOption[] { LinkOption.NOFOLLOW_LINKS });
    System.out.println("Exists? " + path_exists);
}

From source file:Main.java

public static void main(String[] args) {

    Path path = FileSystems.getDefault().getPath("C:/tutorial/Java/JavaFX", "Demo.txt");

    //method 1//from   w  ww .ja  va2s .co  m
    boolean is_regular = Files.isRegularFile(path, LinkOption.NOFOLLOW_LINKS);
}

From source file:Main.java

public static void main(String[] args) {

    Path path = FileSystems.getDefault().getPath("C:/tutorial/Java/JavaFX", "Demo.txt");

    boolean path_notexists = Files.notExists(path, new LinkOption[] { LinkOption.NOFOLLOW_LINKS });

    System.out.println("Not exists? " + path_notexists);
}

From source file:Main.java

public static void main(String[] args) {

    Path path = Paths.get("/tutorial/Java/JavaFX", "Topic.txt");

    // convert path to "real" path
    try {/*from w ww.jav a  2s  . co m*/
        Path real_path = path.toRealPath(LinkOption.NOFOLLOW_LINKS);
        System.out.println("Path to real path: " + real_path);
    } catch (IOException e) {
        System.err.println(e);
    }

}