Example usage for java.nio.file Paths get

List of usage examples for java.nio.file Paths get

Introduction

In this page you can find the example usage for java.nio.file Paths get.

Prototype

public static Path get(URI uri) 

Source Link

Document

Converts the given URI to a Path object.

Usage

From source file:Main.java

public static void main(String[] args) {
    Path path = Paths.get("C:/home/./music/users.txt");
    System.out.println("Normalized: " + path.normalize());

}

From source file:Main.java

public static void main(String[] args) {
    Path path = Paths.get("C:/home/./music/users.txt");

    System.out.println(path.getFileSystem().getSeparator());

}

From source file:Main.java

public static void main(String[] args) {
    Path path = Paths.get("C:/home/./music/users.txt");
    Path path1 = Paths.get("./music/users.txt");
    System.out.println(path.resolveSibling(path1).normalize());

}

From source file:Main.java

public static void main(String[] args) {
    Path path = Paths.get("C:/home/./music/users.txt");
    Path path1 = Paths.get("./music/users.txt");
    System.out.println(path.resolve(path1).normalize());

}

From source file:Test.java

public static void main(String[] args) {
    Path rootPath = Paths.get("/home/docs");
    Path resolvedPath = rootPath.resolve("backup/users.txt");

}

From source file:Test.java

public static void main(String[] args) {
    Path rootPath = Paths.get("/home/docs");
    Path partialPath = Paths.get("users.txt");
    Path resolvedPath = rootPath.resolve(partialPath);

}

From source file:Main.java

public static void main(String[] args) {
    Path rootPath = Paths.get("c:/home/docs");
    System.out.println(rootPath);
    Path partialPath = Paths.get("users.txt");
    System.out.println(partialPath);
    Path resolvedPath = rootPath.resolve(partialPath);
    System.out.println(resolvedPath);
}

From source file:Test.java

public static void main(String[] args) {
    Path path1 = Paths.get("/home/docs/users.txt");
    Path path2 = Paths.get("/home/docs/users.txt");
    Path path3 = Paths.get("/home/music/A.mp3");

    testEquals(path1, path2);/*from   ww  w. ja  va  2  s .co m*/
    testEquals(path1, path3);
}

From source file:Test.java

public static void main(String[] args) {
    Path firstPath = Paths.get("music/A.mp3");
    Path secondPath = Paths.get("docs");

    System.out.println("From firstPath to secondPath: " + firstPath.relativize(secondPath));
    System.out.println("From secondPath to firstPath: " + secondPath.relativize(firstPath));
    System.out.println();/*from  ww  w . j  a v a2  s . c  o m*/

}

From source file:Main.java

public static void main(String[] args) throws Exception {
    Files.list(Paths.get("c:/Java_Dev")).sorted().forEach(System.out::println);
}