コード例 #1
0
ファイル: LzmaDecoder.cs プロジェクト: zhouzu/sharpcompress
 public void Train(Stream stream)
 {
     if (_outWindow is null)
     {
         CreateDictionary();
     }
     _outWindow.Train(stream);
 }
コード例 #2
0
 public void Train(Stream stream)
 {
     if (m_OutWindow == null)
     {
         CreateDictionary();
     }
     m_OutWindow.Train(stream);
 }
コード例 #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="properties"></param>
        /// <param name="inputStream"></param>
        /// <param name="inputSize"></param>
        /// <param name="outputSize"></param>
        /// <param name="presetDictionary"></param>
        /// <param name="isLZMA2"></param>
        public LzmaStream(byte[] properties, Stream inputStream, long inputSize, long outputSize,
                          Stream presetDictionary, bool isLZMA2)
        {
            Properties       = new byte[5];
            this.inputStream = inputStream;
            this.inputSize   = inputSize;
            this.outputSize  = outputSize;
            this.isLZMA2     = isLZMA2;

            if (!isLZMA2)
            {
                dictionarySize = DataConverter.LittleEndian.GetInt32(properties, 1);
                outWindow.Create(dictionarySize);
                if (presetDictionary != null)
                {
                    outWindow.Train(presetDictionary);
                }

                rangeDecoder.Init(inputStream);

                decoder = new Decoder();
                decoder.SetDecoderProperties(properties);
                Properties = properties;

                availableBytes    = outputSize < 0 ? long.MaxValue : outputSize;
                rangeDecoderLimit = inputSize;
            }
            else
            {
                dictionarySize   = 2 | (properties[0] & 1);
                dictionarySize <<= (properties[0] >> 1) + 11;

                outWindow.Create(dictionarySize);
                if (presetDictionary != null)
                {
                    outWindow.Train(presetDictionary);
                    needDictReset = false;
                }

                Properties     = new byte[1];
                availableBytes = 0;
            }
        }
コード例 #4
0
        public LzmaStream(byte[] properties, Stream inputStream, long inputSize, long outputSize,
                          Stream presetDictionary, bool isLzma2)
        {
            _inputStream = inputStream;
            _inputSize   = inputSize;
            _outputSize  = outputSize;
            _isLzma2     = isLzma2;

            if (!isLzma2)
            {
                _dictionarySize = DataConverter.LittleEndian.GetInt32(properties, 1);
                _outWindow.Create(_dictionarySize);
                if (presetDictionary != null)
                {
                    _outWindow.Train(presetDictionary);
                }

                _rangeDecoder.Init(inputStream);

                _decoder = new Decoder();
                _decoder.SetDecoderProperties(properties);
                Properties = properties;

                _availableBytes    = outputSize < 0 ? long.MaxValue : outputSize;
                _rangeDecoderLimit = inputSize;
            }
            else
            {
                _dictionarySize   = 2 | (properties[0] & 1);
                _dictionarySize <<= (properties[0] >> 1) + 11;

                _outWindow.Create(_dictionarySize);
                if (presetDictionary != null)
                {
                    _outWindow.Train(presetDictionary);
                    _needDictReset = false;
                }

                Properties      = new byte[1];
                _availableBytes = 0;
            }
        }
コード例 #5
0
ファイル: LzmaDecoder.cs プロジェクト: yuzp2160/ygosharp
 public bool Train(Stream stream)
 {
     _solid = true;
     return(m_OutWindow.Train(stream));
 }