* When useTileCodec is set, encode the provided raster into
* a byte array.
*/
private byte[] encodeRasterToByteArray(Raster raster) {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
TileEncoder encoder =
tileEncoderFactory.createEncoder(bos,
encodingParam,
raster.getSampleModel());
try {
encoder.encode(raster);
return bos.toByteArray();
} catch (IOException e) {
sendExceptionToListener(JaiI18N.getString("SerializableRenderedImage15"),
new ImagingException(JaiI18N.getString("SerializableRenderedImage15"), e));
// throw new RuntimeException(e.getMessage());