Exemple #1
0
        public int Process(BitStream bitstream, byte[] outputBuffer, int outputBufferOffset)
        {
            Crc = 0;
            for (int i = 0; i < 4; ++i)
            {
                Crc = (Crc << 8) | bitstream.Read(8);
            }

            bool rand    = bitstream.Read(1) != 0;
            int  origPtr = (int)bitstream.Read(24);

            int thisBlockSize = ReadBuffer(bitstream, outputBuffer, outputBufferOffset);

            _inverseBurrowsWheeler.OriginalIndex = origPtr;
            _inverseBurrowsWheeler.Process(outputBuffer, outputBufferOffset, thisBlockSize, outputBuffer,
                                           outputBufferOffset);

            if (rand)
            {
                BZip2Randomizer randomizer = new BZip2Randomizer();
                randomizer.Process(outputBuffer, outputBufferOffset, thisBlockSize, outputBuffer, outputBufferOffset);
            }

            return(thisBlockSize);
        }
        public int Process(BitStream bitstream, byte[] outputBuffer, int outputBufferOffset)
        {
            _crc = 0;
            for (int i = 0; i < 4; ++i)
            {
                _crc = (_crc << 8) | bitstream.Read(8);
            }

            bool rand = bitstream.Read(1) != 0;
            int origPtr = (int)bitstream.Read(24);

            int thisBlockSize = ReadBuffer(bitstream, outputBuffer, outputBufferOffset);

            _inverseBurrowsWheeler.OriginalIndex = origPtr;
            _inverseBurrowsWheeler.Process(outputBuffer, outputBufferOffset, thisBlockSize, outputBuffer, outputBufferOffset);

            if (rand)
            {
                BZip2Randomizer randomizer = new BZip2Randomizer();
                randomizer.Process(outputBuffer, outputBufferOffset, thisBlockSize, outputBuffer, outputBufferOffset);
            }

            return thisBlockSize;
        }