예제 #1
0
 private void Fill()
 {
     if (!_eof)
     {
         int num = _targetStream.Read(_header, 0, 8);
         if (num == 0)
         {
             _unpackedBuffer = null;
             _eof            = true;
         }
         else
         {
             if (num != 8)
             {
                 throw new InvalidDataException("input buffer corrupted (header)");
             }
             int compressedSize = Lz4.GetCompressedSize(_header);
             if (compressedSize == 0)
             {
                 _unpackedBuffer = null;
                 _eof            = true;
             }
             else
             {
                 if ((_readBuffer == null) || (_readBuffer.Length < (compressedSize + 8)))
                 {
                     _readBuffer = new byte[compressedSize + 8];
                 }
                 Buffer.BlockCopy(_header, 0, _readBuffer, 0, 8);
                 if (_targetStream.Read(_readBuffer, 8, compressedSize) != compressedSize)
                 {
                     throw new InvalidDataException("input buffer corrupted (body)");
                 }
                 _unpackedLength   = Lz4.Decompress(_readBuffer, 0, ref _unpackedBuffer);
                 _unpackedOffset   = 0;
                 CompressedLength += _unpackedLength;
             }
         }
     }
 }
예제 #2
0
 //Fast lz4 paced Compression algorithms used:
 //used for XimIndex , XimDocument, XimData Compression.
 public LZ4Compressor()
 {
     Lz4.GetCompressedSize(new byte[] { });
 }