Flashcards in Path Interface Deck (16):
Returns a path object representing the root of the given path, or null if the path does not have a root.
Returns the file name or directory name of the given path. Note that the file/directory name is the last element or name in the given path.
Returns the path object representing the parent of the given path, or null if no parent component exists for the path.
Returns the number of file/directory names in the given path; returns 0 if the given path represents the root.
Returns the i^th file/directory name; the index 0 starts from the closest name to the root.
Path getName(int index)
Returns a path object that is part of this path object; the returned path object has a name that begins at beginIndex till the element at endIndex - 1. In other words, beginInedx is inclusive of the name in that index and exclusive of the name in endIndex. Throws IllegalArguementException if begin index is >= number of elements or endIndex number of elements.
Path subPath(int beginIndex, int endIndex)
Removes redundant elements in path such as . (dot symbol that indicates current directory) and ..(double dot symbol that indicates parent directory)
Resolves a path against the given path.
Path resolve(Path or String other)
Returns true if the given path is an absolute path; false if not.
Returns true if this Path object starts with the given path, or false if not.
Path startsWith(String or Path path)
Returns the absolute path
Returns the URI from the path
Returns an absolute path, but also normalizes it. Also resolves symbolic links. Unlike other methods, throws exception if target does not exist in filesystem.
Checks equality of two path objects, returns true if equal, false if not.
Returns 0 if both paths are equal, a positive integer if this path is lexographically greater than the parameter path, and a negative integer if it is lexographically less.