Path Interface
Package: java.nio.file
The Path interface defines an object that represents a file or directory path. Note that a Path object doesn’t represent the file or directory indicated by the path; it represents the path to the file. The file or directory pointed to by a Path object may or may not actually exist on disk.
Because Path is an interface, not a class, it has no constructors. Of the many ways to create a Path object, one of the most common is to use the get method of the Paths class. For more information, see Paths Class.
Path objects can also be created by static members of the Files class. For more information, see Files Class.
A Path object can be thought of as a root component and a hierarchical sequence of distinct names separated by separator characters (usually backslashes). The root component identifies the file system being used; in a Windows system, this might be a drive letter. The sequence of names represents the directories needed to navigate through the file system to the target file or directory. The last name in the sequence represents the name of the target file or directory itself.
Methods
|
Method |
Description |
|
|
Returns the name of the ... |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access