• Post Reply Bookmark Topic Watch Topic
  • New Topic

Image read and File lock  RSS feed

 
Toufic Diab
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am trying to read an image using javax.ImageIO.read(File f);
whenever I read this image (which you can download from https://app.equadis.com/image.jpg) I catch the following exception
"bandOffsets.length is wrong!"

I don't care about the exception, since I want to delete the image whenever the read() method fails.
But when I try f.delete() the file doesn't get deleted because it's still locked by the read() method.

Can anyone help me and tell me how to delete this file ? (or how to free the file in order to delete it?)
I am compiling using jre1.4.2

Thanks in advance
 
Carlton Hanna
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does your try, catch, finally block look like? You might have to clean up after reaching an exception in your finally block.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!