OutputStream outStream = target.getOutputStream();
try {
// call formatImageOuputStream instead of write to avoid disposition of rendered images
// when processing a tile from a metatile and instead defer it to this class' dispose()
// method
mapEncoder.formatImageOutputStream(tile, outStream, tileContext);
return true;
} finally {
outStream.close();
}
}