if(paramBlock.getNumParameters() > 2) {
param = (ImageEncodeParam)paramBlock.getObjectParameter(2);
}
// Create an ImageEncoder.
ImageEncoder encoder =
ImageCodec.createImageEncoder(format, stream, param);
// Check the ImageEncoder.
if(encoder == null) {
throw new RuntimeException(JaiI18N.getString("EncodeRIF0"));
}
// Store the data.
RenderedImage im = (RenderedImage)paramBlock.getSource(0);
try {
encoder.encode(im);
stream.flush();
// Fix 4665208: EncodeRIF closed the stream after flush
// User may put more into the stream
//stream.close();
} catch (IOException e) {