Example usage for java.nio.file FileSystems getDefault

List of usage examples for java.nio.file FileSystems getDefault

Introduction

In this page you can find the example usage for java.nio.file FileSystems getDefault.

Prototype

public static FileSystem getDefault() 

Source Link

Document

Returns the default FileSystem .

Usage

From source file:Test.java

public static void main(String[] args) {
    Path path = FileSystems.getDefault().getPath("/home/docs/status.txt");

}

From source file:Test.java

public static void main(String[] args) {
    Path path = FileSystems.getDefault().getPath("/home/docs/status.txt");

    System.out.println(path.toString());
}

From source file:Main.java

public static void main(String[] args) {
    Path path = FileSystems.getDefault().getPath("/home/docs/status.txt");

    System.out.println(path.isAbsolute());
}

From source file:Test.java

public static void main(String[] args) {
    Path path = FileSystems.getDefault().getPath("/home/docs/status.txt");

    System.out.printf("getRoot: %s\n", path.getRoot());
}

From source file:Main.java

public static void main(String[] args) {
    Path path = FileSystems.getDefault().getPath("/home/docs/status.txt");

    System.out.printf("getFileName: %s\n", path.getFileName());
}

From source file:Main.java

public static void main(String[] args) {
    Path path = FileSystems.getDefault().getPath("/home/docs/status.txt");
    System.out.println(path);/*from ww w  .j a  va2  s  . c  o  m*/

}

From source file:Test.java

public static void main(String[] args) {
    Path path = FileSystems.getDefault().getPath("/home/docs/status.txt");
    System.out.printf("getNameCount: %d\n", path.getNameCount());
    for (int index = 0; index < path.getNameCount(); index++) {
        System.out.printf("getName(%d): %s\n", index, path.getName(index));
    }//from   ww  w .ja  va  2  s  .c  om
}

From source file:Main.java

public static void main(String[] args) {
    Path path = FileSystems.getDefault().getPath("/home/docs/status.txt");

    path = Paths.get("/home", "docs", "users.txt");
    System.out.println("Absolute path: " + path.toAbsolutePath());

    path = Paths.get("home", "docs", "users.txt");
    System.out.println("Absolute path: " + path.toAbsolutePath());
}

From source file:Test.java

public static void main(String[] args) {
    Path path = FileSystems.getDefault().getPath("/home/docs/status.txt");

    path = Paths.get("/home", "docs", "users.txt");
    System.out.println("Absolute path: " + path.toAbsolutePath());

    //  path = Paths.get("home", "docs", "users.txt");
    //  System.out.println("Absolute path: " + path.toAbsolutePath());

}

From source file:Test.java

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