Fixed a bug in the IFFImageWriter, caused by buffered data not being written to the stream. Adapter streams are now properly flushed/closed.

Test clean-up.
This commit is contained in:
Harald Kuhr
2012-04-02 14:25:28 +02:00
parent 36a05272a5
commit 13a4646ae4
2 changed files with 63 additions and 31 deletions
@@ -102,9 +102,15 @@ public class IFFImageWriter extends ImageWriterBase {
imageOutput.writeInt(IFF.CHUNK_BODY);
imageOutput.writeInt(pImageData.size());
// NOTE: This is much faster than mOutput.write(pImageData.toByteArray())
// NOTE: This is much faster than imageOutput.write(pImageData.toByteArray())
// as the data array is not duplicated
pImageData.writeTo(IIOUtil.createStreamAdapter(imageOutput));
OutputStream adapter = IIOUtil.createStreamAdapter(imageOutput);
try {
pImageData.writeTo(adapter);
}
finally {
adapter.close();
}
if (pImageData.size() % 2 == 0) {
imageOutput.writeByte(0); // PAD
@@ -163,6 +169,8 @@ public class IFFImageWriter extends ImageWriterBase {
}
}
output.flush();
processImageProgress(y * 100f / height);
}