public bool Deflate(bool flush, bool finish) { bool progress; do { FillWindow(); bool canFlush = flush && inputOff == inputEnd; // if (DeflaterConstants.DEBUGGING) { // Console.WriteLine("window: ["+blockStart+","+strstart+"," // +lookahead+"], "+comprFunc+","+canFlush); // } switch (comprFunc) { case DEFLATE_STORED: progress = DeflateStored(canFlush, finish); break; case DEFLATE_FAST: progress = DeflateFast(canFlush, finish); break; case DEFLATE_SLOW: progress = DeflateSlow(canFlush, finish); break; default: throw new Exception(); } } while (pending.IsFlushed() && progress); /* repeat while we have no pending output and progress was made */ return(progress); }
/// <summary> /// Returns true if the stream was finished and no more output bytes /// are available. /// </summary> public bool Finished() { return(state == FINISHED_STATE && pending.IsFlushed()); }