dotGit.Objects.Storage.GitPackReader.UncompressToLength C# (CSharp) Method

UncompressToLength() public method

public UncompressToLength ( long destLength ) : MemoryStream
destLength long
return System.IO.MemoryStream
        public MemoryStream UncompressToLength(long destLength)
        {
            return Zlib.Decompress(this, destLength);
        }

Usage Example

示例#1
0
        public PackObject GetObjectWithOffset(GitPackReader reader)
        {
            Debug.WriteLine("Fetching object with offset: {0}".FormatWith(reader.Position));

              // Read first byte, it contains the type and 4 bits of object length
              byte buffer = reader.ReadByte();
              ObjectType type = (ObjectType)((buffer >> 4) & 7);
              long size = buffer & 0xf;

              // Read byte while 8th bit is 1.
              int bitCount = 4;
              while ((buffer & 0x80) != 0) // >> 7 == 1);
              {
            buffer = reader.ReadByte();

            size |= ((long)buffer & 0x7f) << bitCount;
            bitCount += 7;
              }

              if (type == ObjectType.RefDelta)
              {
            return new REFDelta(size, type, reader);
              }
              else if (type == ObjectType.OFSDelta)
              {
            return new OFSDelta(size, type, reader);
              }
              else
              {
            using (MemoryStream inflated = reader.UncompressToLength(size))
            {
              return new Undeltified(size, type, inflated.ToArray());
            }
              }
        }
All Usage Examples Of dotGit.Objects.Storage.GitPackReader::UncompressToLength