// compress the bytes in input history window private void GetCompressedOutput(OutputBuffer output) { while (inputWindow.BytesAvailable > 0 && SafeToWriteTo(output)) { // Find next match. A match can be a symbol, // a distance/length pair, a symbol followed by a distance/Length pair inputWindow.GetNextSymbolOrMatch(currentMatch); if (currentMatch.State == MatchState.HasSymbol) { WriteChar(currentMatch.Symbol, output); } else if (currentMatch.State == MatchState.HasMatch) { WriteMatch(currentMatch.Length, currentMatch.Position, output); } else { WriteChar(currentMatch.Symbol, output); WriteMatch(currentMatch.Length, currentMatch.Position, output); } } }