/// <exception cref="NGit.Errors.MissingObjectException"></exception> /// <exception cref="System.IO.IOException"></exception> public override ObjectStream OpenStream() { // If the object was recently unpacked, its available loose. // The loose format is going to be faster to access than a // delta applied on top of a base. Use that whenever we can. // ObjectId myId = GetObjectId(); WindowCursor wc = new WindowCursor(db); ObjectLoader ldr = db.OpenObject2(wc, myId.Name, myId); if (ldr != null) { return(ldr.OpenStream()); } InputStream @in = Open(wc); @in = new BufferedInputStream(@in, 8192); // While we inflate the object, also deflate it back as a loose // object. This will later be cleaned up by a gc pass, but until // then we will reuse the loose form by the above code path. // int myType = GetType(); long mySize = GetSize(); ObjectDirectoryInserter odi = ((ObjectDirectoryInserter)db.NewInserter()); FilePath tmp = odi.NewTempFile(); DeflaterOutputStream dOut = odi.Compress(new FileOutputStream(tmp)); odi.WriteHeader(dOut, myType, mySize); @in = new TeeInputStream(@in, dOut); return(new _Filter_195(this, odi, wc, tmp, myId, myType, mySize, @in)); }
public _Filter_195(LargePackedDeltaObject _enclosing, ObjectDirectoryInserter odi , WindowCursor wc, FilePath tmp, ObjectId myId, int baseArg1, long baseArg2, InputStream baseArg3) : base(baseArg1, baseArg2, baseArg3) { this._enclosing = _enclosing; this.odi = odi; this.wc = wc; this.tmp = tmp; this.myId = myId; }