From f11ba01ee26c80e2343f86bdca5ee21128be59fe Mon Sep 17 00:00:00 2001 From: Robert Greene Date: Fri, 27 Jun 2008 18:42:26 +0000 Subject: [PATCH] Correcting behavior when the clear dictionary code is received (0x100). --- .../shrinkit/io/LzwInputStream.java | 21 ++++++------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/src/com/webcodepro/shrinkit/io/LzwInputStream.java b/src/com/webcodepro/shrinkit/io/LzwInputStream.java index 50a25f1..26bca8b 100644 --- a/src/com/webcodepro/shrinkit/io/LzwInputStream.java +++ b/src/com/webcodepro/shrinkit/io/LzwInputStream.java @@ -74,7 +74,12 @@ public class LzwInputStream extends InputStream { return; } if (k == 0x100) { - clearDictionary(); + dictionary = null; + is.setRequestedNumberOfBits(9); + k = 0; + w = null; + entry = null; + newBuffer = true; fillBuffer(); // Warning: recursive call return; } @@ -115,20 +120,6 @@ public class LzwInputStream extends InputStream { newBuffer = true; } -// /** -// * Provide necessary housekeeping to reset LZW stream between NuFX buffer changes. -// * The dictionary is the only item that is not cleared -- that needs to be done -// * explicitly since behavior between LZW/1 and LZW/2 differ. -// */ -// public void resetState() { -// is.clearRemainingBitsOfData(); -// outputBuffer.clear(); -// k = 0; -// w = null; -// entry = null; -// newBuffer = true; -// } - /** * Provide necessary housekeeping to reset LZW stream between NuFX buffer changes. * The dictionary is the only item that is not cleared -- that needs to be done