Exemple #1
0
        public GZipDecompress(Stream read, Stream write)
        {
            _streamRead  = read;
            _streamWrite = write;

            var header = FrameHelper.ReadWindowHeaderFromCompressedStream(_streamRead);

            FramesCount = header.FramesCount;
            _streamWrite.SetLength(header.SourceLength);
        }
Exemple #2
0
        public GZipCompress(Stream toRead, Stream toWrite, int frameLength, int headerId)
        {
            _streamToRead  = toRead;
            _streamToWrite = toWrite;
            _frameLength   = frameLength;
            _headerId      = headerId;

            FramesCount = _streamToRead.Length / _frameLength + (_streamToRead.Length % _frameLength > 0 ? 1 : 0);
            var header = new WindowHeader(1, 1, _streamToRead.Length, FramesCount);

            FrameHelper.WriteWindowHeaderToStream(_streamToWrite, header);
        }
Exemple #3
0
 public IEnumerable <Frame> Read()
 {
     while (_streamRead.Position < _streamRead.Length)
     {
         if (ReadFramesCount >= FramesCount)
         {
             break;
         }
         var frame = FrameHelper.ReadCompressedFrameFromStream(_streamRead);
         ReadFramesCount++;
         yield return(frame);
     }
 }
Exemple #4
0
 public IEnumerable <Frame> Read()
 {
     while (_streamToRead.Position < _streamToRead.Length)
     {
         if (ReadFramesCount >= FramesCount)
         {
             break;
         }
         var needToRead = (int)(((_streamToRead.Length - _streamToRead.Position) > _frameLength)
             ? _frameLength
             : _streamToRead.Length - _streamToRead.Position);
         yield return(FrameHelper.CreateUncompressedFrameFromStream(_streamToRead, needToRead, _headerId, ReadFramesCount++));
     }
 }
Exemple #5
0
 public void Write(Frame frame)
 {
     FrameHelper.WriteFrameToStream(_streamToWrite, frame);
 }