Exemplo n.º 1
0
        private Decompressor(byte[] compressed, Stream output)
        {
            if (compressed.Length < CompressorConstants.BlockSize)
            {
                var scratch = new byte[CompressorConstants.BlockSize];
                Buffer.BlockCopy(compressed, 0, scratch, 0, compressed.Length);

                _ip = new Pointer(scratch);
            }
            else
            {
                _ip = new Pointer(compressed);
            }

            _output = new Writer(output);
            _ipLimit = compressed.Length;
        }
Exemplo n.º 2
0
        private int RawUncompress(byte[] input, int compressedSize, out byte[] output)
        {
            _ip = new Pointer(input);

            //set limit to pointer scope
            _ipLimit = compressedSize;

            //get size of uncompressed data
            int uncompressedSize = (int)ReadUncompressedLength();
            _output = new Writer(uncompressedSize);

            //decompress
            DecompressAllTags();

            //return results
            output = _output.ToArray();
            return uncompressedSize;
        }