/// <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;
}
}