Files isReadable() method in Java with Examples Last Updated : 24 Apr, 2023 Comments Improve Suggest changes Like Article Like Report isReadable() method of java.nio.file.Files help us to check whether Java virtual machine has appropriate privileges that would allow it to open this file for reading or not. This method test file is readable or not. This method checks that a file exists or not and if file exists then it is readable or not. This method returns true if the file exists and is readable or it would return false if the following cases: file does not existexecute access would be denied because the Java virtual machine has insufficient privileges, Syntax: public static boolean isReadable(Path path)Parameters: This method accepts a parameter path which is the path to the file to check. Return value: This method returns true if the file exists and is readable or it would return false if the following cases: file does not existexecute access would be denied because the Java virtual machine has insufficient privileges,Exception: This method will throw SecurityException in the case of the default provider, and a security manager is installed, the checkRead is invoked to check read access to the file. Below programs illustrate isReadable(Path) method: Program 1: Java // Java program to demonstrate // Files.isReadable() method import java.io.IOException; import java.nio.file.*; public class GFG { public static void main(String[] args) { // create object of Path // This file is available on windows and // It is a readable file. Path path = Paths.get("D:\\GIT_EWS_PROJECTS\\logger" + "\\src\\logger" + "\\GFG.java"); // check whether this file // is readable or not boolean result; result = Files.isReadable(path); System.out.println("File " + path + " is Readable = " + result); } } Output: Program 2: Java // Java program to demonstrate // Files.isReadable() method import java.io.IOException; import java.nio.file.*; public class GFG { public static void main(String[] args) { // create an object of Path // This file is available on windows and // It is not a readable file. Path path = Paths.get("D:\\User Aman\\" + "Documents\\MobaXterm\\" + "\\ArrayList.docx"); // check whether this file // is readable or not boolean result; result = Files.isReadable(path); System.out.println("File " + path + " is Readable = " + result); } } Output: Example: Java import java.io.*; import java.nio.file.Files; import java.nio.file.Paths; public class GFG { public static void main(String[] args) { String fileName = "test1.txt"; boolean isFileReadable = Files.isReadable(Paths.get(fileName)); System.out.println("Is " + fileName + " readable? " + isFileReadable); } } Output: Is test1.txt readable? false Comment More infoAdvertise with us Next Article Files isReadable() method in Java with Examples A AmanSingh2210 Follow Improve Article Tags : Java Java-Functions java.nio.file package Java-Files Practice Tags : Java Similar Reads Files isWritable() method in Java with Examples isWritable() method of java.nio.file.Files help us to check whether Java virtual machine has appropriate privileges that would allow it to open this file for writing or not. It means this method test file is writable or not. This method checks that a file exists or not and if file exists then it is 2 min read FileStore isReadOnly() method in Java with Examples The isReadOnly() method of a FileStore class is used to return true if this file store is read-only else false. A file store is called read-only if it does not support write operations or other changes to files. An IOException to be thrown if an attempt to create a file, open an existing file for wr 2 min read File isFile() method in Java with Examples The isFile() function is a part of File class in Java. This function determines whether the is a file or Directory denoted by the abstract filename is File or not. The function returns true if the abstract file path is File else returns false. Function signature: public boolean isFile() Syntax: file 2 min read Files isHidden() method in Java with Examples isHidden() method of java.nio.file.Files help us to check whether or not a file is hidden. This method return true if the file is considered hidden else it returns false. The exact definition of hidden is platform or provider dependent. On UNIX, for example, a file is considered to be hidden if its 2 min read FileSystem isReadOnly() method in Java with Examples The isReadOnly() method of a FileSystem class is used to check whether or not this file system allows only read-only access to its file stores. If the file system allows only read access to its file stores then this method will return true, else false. Syntax: public abstract boolean isReadOnly() Pa 2 min read Like