public BufferedImage read(int i, ImageReadParam imageReadParam) throws IOException {
if (iis == null) {
throw new IllegalArgumentException("input stream == null");
}
DecodingImageSource source = new IISDecodingImageSource(iis);
OffscreenImage image = new OffscreenImage(source);
source.addConsumer(image);
source.load();
// The interrupted flag should be cleared because ImageDecoder interrupts
// current thread while decoding (due its architecture).
Thread.interrupted();
return image.getBufferedImage();
}