I\'m writing Java 6 application and I have to check if a file is readable. However, on Windows canRead()
always returns true
. So I see that probabl
Try to use the following code
public boolean checkFileCanRead(File file){
try {
FileReader fileReader = new FileReader(file.getAbsolutePath());
fileReader.read();
fileReader.close();
} catch (Exception e) {
LOGGER.debug("Exception when checking if file could be read with message:"+e.getMessage(), e);
return false;
}
return true;
}