java.nio.Path
Path This is an interface with a static
method of. This method can be called two ways.
jshell> Path p = Path.of("foo", "baz", "bar");
p ==> foo/baz/bar
jshell> Path q = Path.of("foo/baz/bar");
q ==> foo/baz/bar
jshell> p.equals(q)
$3 ==> true
You can use it to create absoltue or relative paths.
You will notice an (abortive) static service class
Paths; don't use it. Prefer Path.of.
Paths refer to possible locations in your file system.
Some Useful Methods
getParent()isAbsolute()startsWith(String prefix)endsWith(String suffix)
java.nio.Files
There are a variety of ways of getting file properties.
exists(Path p)isReadable(Path p)isWriteable(Path p)isExecutable(Path p)isHidden(Path p)isRegularFile(Path p)isDirectory(Path p)size(Path p)
Reading a File
Files.newBufferedReader(Path p)