TMI-TIFF: Now uses subclasses instead of if-branching for LZW compatibility decoding.

This commit is contained in:
Harald Kuhr
2013-01-29 21:24:51 +01:00
parent 59b91918e0
commit dd849aeea6
3 changed files with 112 additions and 82 deletions
@@ -59,7 +59,7 @@ public class LZWDecoderTest extends DecoderAbstractTestCase {
@Test
public void testShortBitReversedStream() throws IOException {
InputStream stream = new DecoderStream(getClass().getResourceAsStream("/lzw/lzw-short.bin"), new LZWDecoder(true), 128);
InputStream stream = new DecoderStream(getClass().getResourceAsStream("/lzw/lzw-short.bin"), LZWDecoder.create(true), 128);
InputStream unpacked = new ByteArrayInputStream(new byte[512 * 3 * 5]); // Should be all 0's
assertSameStreamContents(unpacked, stream);
@@ -67,7 +67,7 @@ public class LZWDecoderTest extends DecoderAbstractTestCase {
@Test
public void testLongStream() throws IOException {
InputStream stream = new DecoderStream(getClass().getResourceAsStream("/lzw/lzw-long.bin"), new LZWDecoder(), 1024);
InputStream stream = new DecoderStream(getClass().getResourceAsStream("/lzw/lzw-long.bin"), LZWDecoder.create(false), 1024);
InputStream unpacked = getClass().getResourceAsStream("/lzw/unpacked-long.bin");
assertSameStreamContents(unpacked, stream);
@@ -101,7 +101,7 @@ public class LZWDecoderTest extends DecoderAbstractTestCase {
@Override
public Decoder createDecoder() {
return new LZWDecoder();
return LZWDecoder.create(false);
}
@Override