Path getFileSystem() method in Java with Examples Last Updated : 16 Jul, 2019 Comments Improve Suggest changes Like Article Like Report The Path interface was added to Java NIO in Java 7. The Path interface is located in the java.nio.file package, so the fully qualified name of the Java Path interface is java.nio.file.Path. A Java Path instance represents a path in the file system. A path can use to locate either a file or a directory.path of an entity could be of two types one is an absolute path and other is a relative path. The absolute path is the location address from the root to the entity while the relative path is the location address which is relative to some other path. getFileSystem() method of java.nio.file.Path used to return the file system that created this Path object. Syntax: FileSystem getFileSystem() Parameters: This method accepts nothing. Return value: This method returns the file system that created this Path object. Below programs illustrate getFileSystem() method: Program 1: Java // Java program to demonstrate // java.nio.file.Path.getFileSystem() method import java.io.IOException; import java.nio.file.FileSystem; import java.nio.file.Path; import java.nio.file.Paths; public class GFG { public static void main(String[] args) throws IOException { // create object of Path Path path = Paths.get("D:/workspace/AmanCV.docx"); // call getFileSystem() // and get FileSystem object FileSystem fs = path.getFileSystem(); // print separator of FileSystem System.out.println("Separator used for FileSystem: " + fs.getSeparator()); } } Output: Separator used for FileSystem: / Program 2: Java // Java program to demonstrate // java.nio.file.Path.getFileSystem() method import java.io.IOException; import java.nio.file.FileSystem; import java.nio.file.Path; import java.nio.file.Paths; public class GFG { public static void main(String[] args) throws IOException { // create object of Path Path path = Paths.get("D:/Resume.pdf"); // call getFileSystem() // and get FileSystem object FileSystem fs = path.getFileSystem(); // print FileSystem is ReadOnly or not System.out.println("FileSystem is ReadOnly: " + fs.isReadOnly()); } } Output: FileSystem is ReadOnly: false References: https://docs.oracle.com/javase/10/docs/api/java/nio/file/Path.html#getFileSystem() Comment More infoAdvertise with us Next Article Path getFileSystem() method in Java with Examples A AmanSingh2210 Follow Improve Article Tags : Java Java-Functions Java-Path java.nio.file package Practice Tags : Java Similar Reads Path getFileName() method in Java with Examples The Path interface was added to Java NIO in Java 7. The Path interface is located in the java.nio.file package, so the fully qualified name of the Java Path interface is java.nio.file.Path. A Java Path instance represents a path in the file system. A path can use to locate either a file or a directo 2 min read Path getParent() method in Java with Examples The Java Path interface was added to Java NIO in Java 7. The Path interface is located in the java.nio.file package, so the fully qualified name of the Java Path interface is java.nio.file.Path. A Java Path instance represents a path in the file system. A path can use to locate either a file or a di 2 min read Path getRoot() method in Java with Examples The Java Path interface was added to Java NIO in Java 7. The Path interface is located in the java.nio.file package, so the fully qualified name of the Java Path interface is java.nio.file.Path. A Java Path instance represents a path in the file system. A path can use to locate either a file or a di 2 min read URL getFile() method in Java with Examples The getFile() function is a part of URL class. The function getFile() returns the file name of a specified URL. The getFile() function returns the path and the query of the URL. Function Signature: public String getFile() Syntax: url.getFile() Parameter: This function does not require any parameter 2 min read FileStore name() method in Java with Examples The name() method of a FileStore class is used to return the name of this file store as a String. The format of the name is typically the name of the storage pool or volume. The string returned by this method may differ from the string returned by the toString() method. Syntax: public abstract Strin 2 min read Like