LZWDecodeFilter extends MemoryLimitsAwareFilter { @Override public byte[] decode(byte[] b, PdfName filterName, PdfObject decodeParams, PdfDictionary streamDictionary) { ByteArrayOutputStream outputStream = enableMemoryLimitsAwareHandler(streamDictionary); b = LZWDecodeInternal(b, outputStream); b = FlateDecodeFilter.decodePredictor(b, decodeParams); return b; }  static byte[] LZWDecode(byte[] in); @Override byte[] decode(byte[] b, PdfName filterName, PdfObject decodeParams, PdfDictionary streamDictionary);  }
@Test public void decodingTestNonStatic() { byte[] bytes = {(byte) 0x80, 0x0B, 0x60, 0x50, 0x22, 0x0C, 0x0C, (byte) 0x85, 0x01}; String expectedResult = "-----A---B"; LZWDecodeFilter filter = new LZWDecodeFilter(); String decoded = new String(filter.decode(bytes,null, new PdfDictionary(), new PdfDictionary())); Assert.assertEquals(expectedResult, decoded); }