当前位置: 首页>>代码示例>>C#>>正文


C# Transport.PackParser类代码示例

本文整理汇总了C#中NGit.Transport.PackParser的典型用法代码示例。如果您正苦于以下问题:C# PackParser类的具体用法?C# PackParser怎么用?C# PackParser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PackParser类属于NGit.Transport命名空间,在下文中一共展示了PackParser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Inflate

		/// <exception cref="System.IO.IOException"></exception>
		private InputStream Inflate(PackParser.Source src, long inflatedSize)
		{
			inflater.Open(src, inflatedSize);
			return inflater;
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:6,代码来源:PackParser.cs

示例2: Add

			internal virtual void Add(PackParser.UnresolvedDelta d)
			{
				d.next = head;
				head = d;
			}
开发者ID:LunarLanding,项目名称:ngit,代码行数:5,代码来源:PackParser.cs

示例3: InflateAndSkip

		/// <exception cref="System.IO.IOException"></exception>
		private void InflateAndSkip(PackParser.Source src, long inflatedSize)
		{
			InputStream inf = Inflate(src, inflatedSize);
			IOUtil.SkipFully(inf, inflatedSize);
			inf.Close();
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:7,代码来源:PackParser.cs

示例4: InflateAndReturn

		/// <exception cref="System.IO.IOException"></exception>
		private byte[] InflateAndReturn(PackParser.Source src, long inflatedSize)
		{
			byte[] dst = new byte[(int)inflatedSize];
			InputStream inf = Inflate(src, inflatedSize);
			IOUtil.ReadFully(inf, dst, 0, dst.Length);
			inf.Close();
			return dst;
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:9,代码来源:PackParser.cs

示例5: ReadObjectHeader

		/// <summary>Read the header of the current object.</summary>
		/// <remarks>
		/// Read the header of the current object.
		/// <p>
		/// After the header has been parsed, this method automatically invokes
		/// <see cref="OnObjectHeader(Source, byte[], int, int)">OnObjectHeader(Source, byte[], int, int)
		/// 	</see>
		/// to allow the
		/// implementation to update its internal checksums for the bytes read.
		/// <p>
		/// When this method returns the database will be positioned on the first
		/// byte of the deflated data stream.
		/// </remarks>
		/// <param name="info">the info object to populate.</param>
		/// <returns>
		/// 
		/// <code>info</code>
		/// , after populating.
		/// </returns>
		/// <exception cref="System.IO.IOException">the size cannot be read.</exception>
		protected internal virtual PackParser.ObjectTypeAndSize ReadObjectHeader(PackParser.ObjectTypeAndSize
			 info)
		{
			int hdrPtr = 0;
			int c = ReadFrom(PackParser.Source.DATABASE);
			hdrBuf[hdrPtr++] = unchecked((byte)c);
			info.type = (c >> 4) & 7;
			long sz = c & 15;
			int shift = 4;
			while ((c & unchecked((int)(0x80))) != 0)
			{
				c = ReadFrom(PackParser.Source.DATABASE);
				hdrBuf[hdrPtr++] = unchecked((byte)c);
				sz += ((long)(c & unchecked((int)(0x7f)))) << shift;
				shift += 7;
			}
			info.size = sz;
			switch (info.type)
			{
				case Constants.OBJ_COMMIT:
				case Constants.OBJ_TREE:
				case Constants.OBJ_BLOB:
				case Constants.OBJ_TAG:
				{
					OnObjectHeader(PackParser.Source.DATABASE, hdrBuf, 0, hdrPtr);
					break;
				}

				case Constants.OBJ_OFS_DELTA:
				{
					c = ReadFrom(PackParser.Source.DATABASE);
					hdrBuf[hdrPtr++] = unchecked((byte)c);
					while ((c & 128) != 0)
					{
						c = ReadFrom(PackParser.Source.DATABASE);
						hdrBuf[hdrPtr++] = unchecked((byte)c);
					}
					OnObjectHeader(PackParser.Source.DATABASE, hdrBuf, 0, hdrPtr);
					break;
				}

				case Constants.OBJ_REF_DELTA:
				{
					System.Array.Copy(buf, Fill(PackParser.Source.DATABASE, 20), hdrBuf, hdrPtr, 20);
					hdrPtr += 20;
					Use(20);
					OnObjectHeader(PackParser.Source.DATABASE, hdrBuf, 0, hdrPtr);
					break;
				}

				default:
				{
					throw new IOException(MessageFormat.Format(JGitText.Get().unknownObjectType, Sharpen.Extensions.ValueOf
						(info.type)));
				}
			}
			return info;
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:78,代码来源:PackParser.cs

示例6: SeekDatabase

		/// <exception cref="System.IO.IOException"></exception>
		protected internal override PackParser.ObjectTypeAndSize SeekDatabase(PackParser.UnresolvedDelta
			 delta, PackParser.ObjectTypeAndSize info)
		{
			@out.Seek(delta.GetOffset());
			crc.Reset();
			return ReadObjectHeader(info);
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:8,代码来源:ObjectDirectoryPackParser.cs

示例7: NewInfo

		/// <summary>Construct a PackedObjectInfo instance for this parser.</summary>
		/// <remarks>Construct a PackedObjectInfo instance for this parser.</remarks>
		/// <param name="id">identity of the object to be tracked.</param>
		/// <param name="delta">
		/// if the object was previously an unresolved delta, this is the
		/// delta object that was tracking it. Otherwise null.
		/// </param>
		/// <param name="deltaBase">
		/// if the object was previously an unresolved delta, this is the
		/// ObjectId of the base of the delta. The base may be outside of
		/// the pack stream if the stream was a thin-pack.
		/// </param>
		/// <returns>info object containing this object's data.</returns>
		protected internal virtual PackedObjectInfo NewInfo(AnyObjectId id, PackParser.UnresolvedDelta
			 delta, ObjectId deltaBase)
		{
			PackedObjectInfo oe = new PackedObjectInfo(id);
			if (delta != null)
			{
				oe.SetCRC(delta.crc);
			}
			return oe;
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:23,代码来源:PackParser.cs

示例8: Open

			/// <exception cref="System.IO.IOException"></exception>
			internal virtual void Open(PackParser.Source source, long inflatedSize)
			{
				this.src = source;
				this.expectedSize = inflatedSize;
				this.actualSize = 0;
				this.p = this._enclosing.Fill(this.src, 1);
				this.inf.SetInput(this._enclosing.buf, this.p, this._enclosing.bAvail);
			}
开发者ID:LunarLanding,项目名称:ngit,代码行数:9,代码来源:PackParser.cs

示例9: ReadFrom

		// Consume exactly one byte from the buffer and return it.
		/// <exception cref="System.IO.IOException"></exception>
		private int ReadFrom(PackParser.Source src)
		{
			if (bAvail == 0)
			{
				Fill(src, 1);
			}
			bAvail--;
			return buf[bOffset++] & unchecked((int)(0xff));
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:11,代码来源:PackParser.cs

示例10: Fill

		// Ensure at least need bytes are available in in {@link #buf}.
		/// <exception cref="System.IO.IOException"></exception>
		private int Fill(PackParser.Source src, int need)
		{
			while (bAvail < need)
			{
				int next = bOffset + bAvail;
				int free = buf.Length - next;
				if (free + bAvail < need)
				{
					switch (src)
					{
						case PackParser.Source.INPUT:
						{
							Sync();
							break;
						}

						case PackParser.Source.DATABASE:
						{
							if (bAvail > 0)
							{
								System.Array.Copy(buf, bOffset, buf, 0, bAvail);
							}
							bOffset = 0;
							break;
						}
					}
					next = bAvail;
					free = buf.Length - next;
				}
				switch (src)
				{
					case PackParser.Source.INPUT:
					{
						next = @in.Read(buf, next, free);
						break;
					}

					case PackParser.Source.DATABASE:
					{
						next = ReadDatabase(buf, next, free);
						break;
					}
				}
				if (next <= 0)
				{
					throw new EOFException(JGitText.Get().packfileIsTruncated);
				}
				bAvail += next;
			}
			return bOffset;
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:53,代码来源:PackParser.cs

示例11: OpenDatabase

		/// <exception cref="System.IO.IOException"></exception>
		private PackParser.ObjectTypeAndSize OpenDatabase(PackParser.UnresolvedDelta delta
			, PackParser.ObjectTypeAndSize info)
		{
			bOffset = 0;
			bAvail = 0;
			return SeekDatabase(delta, info);
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:8,代码来源:PackParser.cs

示例12: DeltaVisit

			internal DeltaVisit(PackParser.DeltaVisit parent)
			{
				// At the root of the stack we have a base.
				this.parent = parent;
				this.delta = parent.nextChild;
				parent.nextChild = delta.next;
			}
开发者ID:LunarLanding,项目名称:ngit,代码行数:7,代码来源:PackParser.cs

示例13: OnObjectData

		/// <summary>Store (and/or checksum) a portion of an object's data.</summary>
		/// <remarks>
		/// Store (and/or checksum) a portion of an object's data.
		/// <p>
		/// This method may be invoked multiple times per object, depending on the
		/// size of the object, the size of the parser's internal read buffer, and
		/// the alignment of the object relative to the read buffer.
		/// <p>
		/// Invoked after
		/// <see cref="OnObjectHeader(Source, byte[], int, int)">OnObjectHeader(Source, byte[], int, int)
		/// 	</see>
		/// .
		/// </remarks>
		/// <param name="src">where the data came from</param>
		/// <param name="raw">buffer to read data from.</param>
		/// <param name="pos">first offset within buffer that is valid.</param>
		/// <param name="len">number of bytes in buffer that are valid.</param>
		/// <exception cref="System.IO.IOException">the stream cannot be archived.</exception>
		protected internal abstract void OnObjectData(PackParser.Source src, byte[] raw, 
			int pos, int len);
开发者ID:LunarLanding,项目名称:ngit,代码行数:20,代码来源:PackParser.cs

示例14: InflaterStream

			public InflaterStream(PackParser _enclosing)
			{
				this._enclosing = _enclosing;
				this.inf = InflaterCache.Get();
				this.skipBuffer = new byte[512];
			}
开发者ID:LunarLanding,项目名称:ngit,代码行数:6,代码来源:PackParser.cs

示例15: SeekDatabase

		/// <summary>Reposition the database to re-read a previously stored object.</summary>
		/// <remarks>
		/// Reposition the database to re-read a previously stored object.
		/// <p>
		/// If the database is computing CRC-32 checksums for object data, it should
		/// reset its internal CRC instance during this method call.
		/// </remarks>
		/// <param name="obj">
		/// the object position to begin reading from. This is from
		/// <see cref="NewInfo(NGit.AnyObjectId, UnresolvedDelta, NGit.ObjectId)">NewInfo(NGit.AnyObjectId, UnresolvedDelta, NGit.ObjectId)
		/// 	</see>
		/// .
		/// </param>
		/// <param name="info">object to populate with type and size.</param>
		/// <returns>
		/// the
		/// <code>info</code>
		/// object.
		/// </returns>
		/// <exception cref="System.IO.IOException">the database cannot reposition to this location.
		/// 	</exception>
		protected internal abstract PackParser.ObjectTypeAndSize SeekDatabase(PackedObjectInfo
			 obj, PackParser.ObjectTypeAndSize info);
开发者ID:LunarLanding,项目名称:ngit,代码行数:23,代码来源:PackParser.cs


注:本文中的NGit.Transport.PackParser类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。