### Question:
LZWCodec implements IByteArrayCodec { public void decode (@Nonnull @WillNotClose final InputStream aEncodedIS, @Nonnull @WillNotClose final OutputStream aOS) { ValueEnforcer.notNull (aEncodedIS, "EncodedInputStream"); ValueEnforcer.notNull (aOS, "OutputStream"); final NonBlockingBitInputStream aBIS = new NonBlockingBitInputStream (aEncodedIS, ByteOrder.LITTLE_ENDIAN); try { final LZWDecodeDictionary aDict = new LZWDecodeDictionary (); aDict.reset (); int nCode = aDict.readCode (aBIS); while (nCode == AbstractLZWDictionary.CODE_CLEARTABLE) nCode = aDict.readCode (aBIS); if (nCode != AbstractLZWDictionary.CODE_EOF) { byte [] aByteSeq = aDict.directGetAllBytes (nCode); if (aByteSeq == null) throw new DecodeException ("Failed to resolve initial code " + nCode); aOS.write (aByteSeq); byte [] aPrevByteSeq = aByteSeq; while (true) { nCode = aDict.readCode (aBIS); if (nCode == AbstractLZWDictionary.CODE_EOF) break; if (nCode == AbstractLZWDictionary.CODE_CLEARTABLE) { aDict.reset (); nCode = aDict.readCode (aBIS); if (nCode == AbstractLZWDictionary.CODE_EOF) break; aByteSeq = aDict.directGetAllBytes (nCode); aOS.write (aByteSeq); aPrevByteSeq = aByteSeq; } else { final int nNextFreeCode = aDict.getNextFreeCode (); if (nCode < nNextFreeCode) aByteSeq = aDict.directGetAllBytes (nCode); else if (nCode == nNextFreeCode) aByteSeq = ArrayHelper.getConcatenated (aPrevByteSeq, aPrevByteSeq[0]); else throw new DecodeException ("Error decoding LZW: unexpected code " + nCode + " while next free code is " + nNextFreeCode); aOS.write (aByteSeq); aDict.addEntry (ArrayHelper.getConcatenated (aPrevByteSeq, aByteSeq[0]), false); aPrevByteSeq = aByteSeq; } } } } catch (final EOFException ex) { throw new DecodeException ("Unexpected EOF decoding LZW", ex); } catch (final IOException ex) { throw new DecodeException ("Failed to decode LZW", ex); } } LZWCodec(); void encode(@Nullable final byte [] aBuffer,
                      @Nonnegative final int nOfs,
                      @Nonnegative final int nLen,
                      @Nonnull @WillNotClose final OutputStream aOS); void decode(@Nonnull @WillNotClose final InputStream aEncodedIS, @Nonnull @WillNotClose final OutputStream aOS); void decode(@Nullable final byte [] aEncodedBuffer,
                      @Nonnegative final int nOfs,
                      @Nonnegative final int nLen,
                      @Nonnull @WillNotClose final OutputStream aOS);  }### Answer:
@Test public void testDecode () { final LZWCodec c = new LZWCodec (); final byte [] aEncoded = new byte [] { (byte) 0x80, 0x0b, 0x60, 0x50, 0x22, 0x0c, 0x0c, (byte) 0x85, 0x01 }; final byte [] aDecoded = c.getDecoded (aEncoded); final byte [] aExpected = new byte [] { 45, 45, 45, 45, 45, 65, 45, 45, 45, 66 }; assertArrayEquals (aExpected, aDecoded); }