Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
 /// <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());
 }