mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2026-05-01 00:00:02 -04:00
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:
+10
-2
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user