September 2019
Intermediate to advanced
816 pages
18h 47m
English
Joining (or combining) file paths means defining a fixed root path and appending to it a partial path or replacing a part of it (for example, a filename needs to be replaced with another filename). Basically, this is a handy technique when we want to create new paths that share a common fixed part.
This can be accomplished via NIO.2 and the Path.resolve() and Path.resolveSibling() methods.
Let's consider the following fixed root path:
Path base = Paths.get("D:/learning/packt");
Let's also assume that we want to obtain the Path for two different books:
// D:\learning\packt\JBossTools3.pdfPath path = base.resolve("JBossTools3.pdf");// D:\learning\packt\MasteringJSF22.pdfPath path = base.resolve("MasteringJSF22.pdf"); ...