Files getFileStore() method in Java with Examples
getFileStore() method of java.nio.file.Files help us to return the FileStore object which represents the file store where a file is located. Once you get a reference to the FileStore you can apply fileStrore type of operation to get information of filestore.
public static FileStore getFileStore(Path path) throws IOException
Parameters: This method accepts a parameter path which is the path to the file to get FileStore.
Return value: This method returns the file store where the file is stored.
Exception: This method will throw following exceptions:
- IOException: if an I/O error occurs
- SecurityException: In the case of the default provider, and a security manager is installed, the SecurityManager.checkgetFileStore(String) method is invoked to check to getFileStore access to the file
Below programs illustrate getFileStore(Path) method:
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.