### Question:
LzssCodec { public static void decompress(OutputStream dst, InputStream src) throws IOException { ByteBuffer textBuf = ByteBuffer.allocate(N + F - 1); int flags; for (int i = 0; i < N - F; i++) { textBuf.put((byte) ' '); } textBuf.position(N - F); flags = 0; for (;;) { if (((flags >>>= 1) & 0x100) == 0) { int c = src.read(); if (c == -1) { break; } flags = c | 0xFF00; } if ((flags & 1) != 0) { int c = src.read(); if (c == -1) { break; } dst.write(c); textBuf.put((byte) c); textBuf.position(textBuf.position() & (N - 1)); } else { int i = src.read(); if (i == -1) { break; } int j = src.read(); if (j == -1) { break; } i |= ((j & 0xF0) << 4); j = (j & 0x0F) + THRESHOLD; for (int k = 0; k <= j; k++) { int c = textBuf.get((i + k) & (N - 1)); dst.write(c); textBuf.put((byte) c); textBuf.position(textBuf.position() & (N - 1)); } } } dst.flush(); }  static void decompress(OutputStream dst, InputStream src); static void compress(OutputStream dst, InputStream src); static final int N; static final int F; static final int THRESHOLD; static final int NIL; }### Answer:
@Test public void testDecompress() throws Exception { ByteArrayOutputStream dst = new ByteArrayOutputStream(); InputStream src = new ByteArrayInputStream(TEST_COMPRESSED); LzssCodec.decompress(dst, src); String out = new String(dst.toByteArray()); assertEquals(TEST_TEXT, out); }