Beispiel #1
0
 internal void GetBlock(DeflateInput input, OutputBuffer output, int maxBytesToCopy)
 {
     Debug.Assert(this.InputAvailable(input), "call SetInput before trying to compress!");
     FastEncoder.WriteDeflatePreamble(output);
     this.GetCompressedOutput(input, output, maxBytesToCopy);
     this.WriteEndOfBlock(output);
 }
Beispiel #2
0
 internal DeflaterManaged()
 {
     this.deflateEncoder  = new FastEncoder();
     this.copyEncoder     = new CopyEncoder();
     this.input           = new DeflateInput();
     this.output          = new OutputBuffer();
     this.processingState = DeflaterManaged.DeflaterState.NotStarted;
 }
Beispiel #3
0
 private void GetCompressedOutput(OutputBuffer output)
 {
     while (this.inputWindow.BytesAvailable > 0 && this.SafeToWriteTo(output))
     {
         this.inputWindow.GetNextSymbolOrMatch(this.currentMatch);
         if (this.currentMatch.State == MatchState.HasSymbol)
         {
             FastEncoder.WriteChar(this.currentMatch.Symbol, output);
         }
         else if (this.currentMatch.State == MatchState.HasMatch)
         {
             FastEncoder.WriteMatch(this.currentMatch.Length, this.currentMatch.Position, output);
         }
         else
         {
             FastEncoder.WriteChar(this.currentMatch.Symbol, output);
             FastEncoder.WriteMatch(this.currentMatch.Length, this.currentMatch.Position, output);
         }
     }
 }
Beispiel #4
0
 internal void GetBlockHeader(OutputBuffer output)
 {
     FastEncoder.WriteDeflatePreamble(output);
 }