/// <summary>Initialize a pack parser.</summary> /// <remarks>Initialize a pack parser.</remarks> /// <param name="odb">database the parser will write its objects into.</param> /// <param name="src">the stream the parser will read.</param> protected internal PackParser(ObjectDatabase odb, InputStream src) { objectDatabase = odb.NewCachedDatabase(); @in = src; inflater = new PackParser.InflaterStream(this); readCurs = objectDatabase.NewReader(); buf = new byte[BUFFER_SIZE]; tempBuffer = new byte[BUFFER_SIZE]; hdrBuf = new byte[64]; objectDigest = Constants.NewMessageDigest(); tempObjectId = new MutableObjectId(); packDigest = Constants.NewMessageDigest(); }
/// <summary>Create a new pack indexer utility.</summary> /// <remarks>Create a new pack indexer utility.</remarks> /// <param name="db"></param> /// <param name="src"> /// stream to read the pack data from. If the stream is buffered /// use /// <see cref="BUFFER_SIZE">BUFFER_SIZE</see> /// as the buffer size for the stream. /// </param> /// <param name="dstBase"></param> /// <exception cref="System.IO.IOException">the output packfile could not be created. /// </exception> public IndexPack(Repository db, InputStream src, FilePath dstBase) { repo = db; objectDatabase = db.ObjectDatabase.NewCachedDatabase(); @in = src; inflater = new IndexPack.InflaterStream(this); readCurs = objectDatabase.NewReader(); buf = new byte[BUFFER_SIZE]; readBuffer = new byte[BUFFER_SIZE]; objectDigest = Constants.NewMessageDigest(); tempObjectId = new MutableObjectId(); packDigest = Constants.NewMessageDigest(); if (dstBase != null) { FilePath dir = dstBase.GetParentFile(); string nam = dstBase.GetName(); dstPack = new FilePath(dir, nam + ".pack"); dstIdx = new FilePath(dir, nam + ".idx"); packOut = new RandomAccessFile(dstPack, "rw"); packOut.SetLength(0); } else { dstPack = null; dstIdx = null; } }