javax.imageio.IIOException: Can't create an ImageInputStream!
posted 4 years ago
I am getting the exception from the title of this post whenever I try to run the following code:
File imageFile = new File (path);
BufferedImage img = ImageIO.read(imageFile);
I know that it a permissions-related problem not that the image has the read-only flag checked, but, that my user (at an OS level) does not have permission to open the image - I'm not even capable of opening it directly with the OS.
My question to YOU guys is, is there any way to check the permissions before trying to open a File. I do not want to use
File.canRead(), File.canWrite(), or File.canExecute() because they check whether the file has the read-only flag checked, but that does not work for me.
What I need to check is if the user has permissions over the object he's trying to open.