Java Utililty Methods Path Resolve nio

List of utility methods to do Path Resolve nio

Description

The list of methods to do Path Resolve nio are organized into topic(s).

Method

intresolveMaxStep(String rootPath)
resolve Max Step
int maxStep = 0;
while (Files.exists(Paths.get(rootPath + File.separator + String.valueOf(maxStep + 1)))) {
    maxStep++;
return maxStep;
PathresolvePath(final Path baseDirPath, final Path userPath)
Resolves an untrusted user-specified path against the API's base directory.
final Path resolvedPath = baseDirPath.resolve(userPath).normalize();
if (!baseDirPath.isAbsolute()) {
    throw new IllegalArgumentException("Base path must be absolute");
if (userPath.isAbsolute()) {
    throw new IllegalArgumentException("User path must be relative");
if (!resolvedPath.startsWith(baseDirPath)) {
...
LinkedListresolvePathElements(final Path path)
resolve Path Elements
final LinkedList<String> elements = Lists.newLinkedList();
final String[] elementArray = path.toString().split(Pattern.quote(path.getFileSystem().getSeparator()));
for (final String element : elementArray) {
    if (!Strings.isNullOrEmpty(element)) {
        elements.add(element);
return elements;
...
FileresolveSymLink(Path link)
resolve Sym Link
return Files.readSymbolicLink(link).toFile();