CCITT Fax writer: adjust formatting and write finishing bytes on last row instead of on stream closing

This commit is contained in:
Schmidor
2015-10-09 23:18:56 +02:00
parent 585b5faa62
commit c8621439c0
2 changed files with 81 additions and 73 deletions
@@ -28,22 +28,15 @@
package com.twelvemonkeys.imageio.plugins.tiff;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.awt.image.BufferedImage;
import java.awt.image.DataBufferByte;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.OutputStream;
import com.twelvemonkeys.imageio.plugins.tiff.CCITTFaxEncoderStream.Code;
import org.junit.Before;
import org.junit.Test;
import com.twelvemonkeys.imageio.plugins.tiff.CCITTFaxEncoderStream.Code;
import java.awt.image.BufferedImage;
import java.awt.image.DataBufferByte;
import java.io.*;
import static org.junit.Assert.*;
/**
* CCITTFaxEncoderStreamTest
@@ -122,7 +115,7 @@ public class CCITTFaxEncoderStreamTest {
byte[] imageData = ((DataBufferByte) image.getData().getDataBuffer()).getData();
byte[] redecodedData = new byte[imageData.length];
ByteArrayOutputStream imageOutput = new ByteArrayOutputStream();
OutputStream outputSteam = new CCITTFaxEncoderStream(imageOutput, 6, type, fillOrder, options);
OutputStream outputSteam = new CCITTFaxEncoderStream(imageOutput, 6, 4, type, fillOrder, options);
outputSteam.write(imageData);
outputSteam.close();
byte[] encodedData = imageOutput.toByteArray();