java.nio.file.FileSystems Class in Java
java.nio.file.FileSystems class acts as a factory for creating new file systems. This class provides methods for creating file systems. This file system act as factories for creating different objects like Path, PathMatcher, UserPrincipalLookupService, and WatchService. This object helps to access the files and other objects in the file system.
Syntax: Class declaration
public final class FileSystems extends Object
Methods of this class is as follows:
Method Description getDefault() This method returns a new default FileSystem. getFileSystem(URI uri) This method returns a reference to an existing FileSystem. newFileSystem(Path path, ClassLoader loader) This method is used to construct a new FileSystem to access the contents of the files of this file system. newFileSystem(URI uri, Map<String,?> env) This method is used to create a new File system using the given URI newFileSystem(URI uri, Map<String,?> env, ClassLoader loader) This method is used to create a new File system using the given URI
File System created successfully File system is open
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.