P
_pr0p
Hi,
my program is throwing this exception:
Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException:
javax.imageio.IIOException: Can't create cache file!
at org.ordanomade.interfaccia.ImageKit.read(ImageKit.java:30)
..........
Caused by:
at javax.imageio.ImageIO.createImageInputStream(ImageIO.java:335)
at javax.imageio.ImageIO.read(ImageIO.java:1325)
and next:
Caused by: java.io.IOException: Too many open files
at java.io.UnixFileSystem.createFileExclusively(Native Method)
The piece of code interested is this:
....
byte[] bytes = ImageKit.getBytes(chunkImage, quality/100f);
BufferedImage chunkImage = ImageKit.read(bytes);
.....
//this is ImageKit file where the exception is thrown
public static BufferedImage read(byte[] bytes) {
try {
return ImageIO.read(new ByteArrayInputStream(bytes));
} catch(IOException e) {
throw new RuntimeException(e);
}
}
I have to open many times different part of an image (I asked here before
about how to do this).
The question is:
how can I release (close) resources allocated by that BufferedImage? I
didn't find
a suitable method to do this.
Thank you in advance!
Have a nice day,
Gabriele
my program is throwing this exception:
Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException:
javax.imageio.IIOException: Can't create cache file!
at org.ordanomade.interfaccia.ImageKit.read(ImageKit.java:30)
..........
Caused by:
at javax.imageio.ImageIO.createImageInputStream(ImageIO.java:335)
at javax.imageio.ImageIO.read(ImageIO.java:1325)
and next:
Caused by: java.io.IOException: Too many open files
at java.io.UnixFileSystem.createFileExclusively(Native Method)
The piece of code interested is this:
....
byte[] bytes = ImageKit.getBytes(chunkImage, quality/100f);
BufferedImage chunkImage = ImageKit.read(bytes);
.....
//this is ImageKit file where the exception is thrown
public static BufferedImage read(byte[] bytes) {
try {
return ImageIO.read(new ByteArrayInputStream(bytes));
} catch(IOException e) {
throw new RuntimeException(e);
}
}
I have to open many times different part of an image (I asked here before
about how to do this).
The question is:
how can I release (close) resources allocated by that BufferedImage? I
didn't find
a suitable method to do this.
Thank you in advance!
Have a nice day,
Gabriele