writer = newSpi.createWriterInstance();
// Check if the input object is an OutputStream
if (destination instanceof OutputStream) {
// Use of the ImageOutputStreamAdapter
if (isAggressiveOutputStreamSupported()) {
stream = new ImageOutputStreamAdapter((OutputStream) destination);
} else {
stream = new MemoryCacheImageOutputStream((OutputStream) destination);
}
// Preparation of the ImageWriteParams