Freeing locked files
I am using JAI to convert a TIFF image to a PNG image. The following code works fine:
RenderedOp img = JAI.create("fileload", "my-tiff-file");
JAI.create("filestore", img, "my-png-file", "PNG");
However, after the image creation I find the source and destination files are locked in some manner (possibly open). After processing I want to move the files with File.renameTo(File) but the operation fails. If I try to move the files in Windows Explorer I get a sharing violation message which usually indicates the file is open. The files are freed once the program terminates.
I can't see anything in the API that allows me to free whatever resource is holding on to the files. Any ideas?