Plupload.PngEncoder.DeflaterEngine.DeflateStored C# (CSharp) Method

DeflateStored() private method

private DeflateStored ( bool flush, bool finish ) : bool
flush bool
finish bool
return bool
        bool DeflateStored(bool flush, bool finish)
        {
            if (!flush && (lookahead == 0)) {
                return false;
            }

            strstart += lookahead;
            lookahead = 0;

            int storedLength = strstart - blockStart;

            if ((storedLength >= DeflaterConstants.MAX_BLOCK_SIZE) || // Block is full
                (blockStart < WSIZE && storedLength >= MAX_DIST) ||   // Block may move out of window
                flush) {
                bool lastBlock = finish;
                if (storedLength > DeflaterConstants.MAX_BLOCK_SIZE) {
                    storedLength = DeflaterConstants.MAX_BLOCK_SIZE;
                    lastBlock = false;
                }

            #if DebugDeflation
                if (DeflaterConstants.DEBUGGING)
                {
                   Console.WriteLine("storedBlock[" + storedLength + "," + lastBlock + "]");
                }
            #endif

                huffman.FlushStoredBlock(window, blockStart, storedLength, lastBlock);
                blockStart += storedLength;
                return !lastBlock;
            }
            return true;
        }