Using the Compression Algorithm

To use the LZ77 compression algorithm:

  1. Set the coding position to the beginning of the input stream.

  2. Find the longest match in the window for the lookahead buffer.

  3. Output the P,C pair, where P is the pointer to the match in the window, and C is the first byte in the lookahead buffer that does not match.

  4. If the lookahead buffer is not empty, move the coding position (and the window) L+1 bytes forward.

  5. Return to step 2.