A
Andre Raue
Hello,
how do I check, if an image file was successfully loaded when I use
the Java Advanced Imaging API (JAI)?
I thought, that JAI.create("fileload", ...) should return 'null', when
file loading fails. But this is not the case. I never get a return
value of 'null', even if I try to open a .WAV oder .TXT file. Instead,
I receive a Runtime Exception when calling a method of the returned
image object (see example below).
My configuration:
JAI 1.1.2_1
J2SE SDK 1.4.2_04
-------- Example
// load image
PlanarImage image =
JAI.create("fileload", "C:/someValidPath/noImage.xyz");
if(image == null){
System.out.println("Could not load image!"); //<--- never reached
}
// Print out number of bands
System.out.println("image has " + image.getNumBands() +
" band(s)"); // <--- ! Exception !
-------- End of example
Greetings,
Andre
how do I check, if an image file was successfully loaded when I use
the Java Advanced Imaging API (JAI)?
I thought, that JAI.create("fileload", ...) should return 'null', when
file loading fails. But this is not the case. I never get a return
value of 'null', even if I try to open a .WAV oder .TXT file. Instead,
I receive a Runtime Exception when calling a method of the returned
image object (see example below).
My configuration:
JAI 1.1.2_1
J2SE SDK 1.4.2_04
-------- Example
// load image
PlanarImage image =
JAI.create("fileload", "C:/someValidPath/noImage.xyz");
if(image == null){
System.out.println("Could not load image!"); //<--- never reached
}
// Print out number of bands
System.out.println("image has " + image.getNumBands() +
" band(s)"); // <--- ! Exception !
-------- End of example
Greetings,
Andre