- Code: Select all
/* open image reader */
ImageReader imgReader = new ImageReader();
IFormatReader formatReader = imgReader.getReader("file.tif");
formatReader.setId("file.tif");
BufferedImageReader bufferedImageReader = new BufferedImageReader(formatReader);
BufferedImage buffImage = bufferedImageReader.openThumbImage(0);
/* close image reader */
imgReader.close();
imgReader = null;
formatReader.close();
formatReader = null;
/* delete file */
File filenameObj = new File("file.tif");
boolean boolFile = filenameObj.delete();
The delete file will not work. I think its because of line 135 (Location.getHandle(id);) in ImageReader in the public IFormatReader getReader(String id) method. It returns an IRandomAccess which needs to be closed. When i replace that code with the following it seems to work fine.
- Code: Select all
IRandomAccess canReadID = Location.getHandle(id);
canReadID.close();
I dont know if this change has any side effects furthur on. Could someone comment on the same? If its a valid issue, maybe it could be fixed next release.
~Thanks