예제 #1
0
        /// <exception cref="NGit.Errors.MissingObjectException"></exception>
        /// <exception cref="System.IO.IOException"></exception>
        public override ObjectStream OpenStream()
        {
            WindowCursor wc = new WindowCursor(db);
            InputStream  @in;

            try
            {
                @in = new PackInputStream(pack, objectOffset + headerLength, wc);
            }
            catch (IOException)
            {
                // If the pack file cannot be pinned into the cursor, it
                // probably was repacked recently. Go find the object
                // again and open the stream from that location instead.
                //
                return(wc.Open(GetObjectId(), type).OpenStream());
            }
            @in = new BufferedInputStream(new InflaterInputStream(@in, wc.Inflater(), 8192),
                                          8192);
            //
            //
            //
            //
            //
            return(new ObjectStream.Filter(type, size, @in));
        }
예제 #2
0
        /// <exception cref="NGit.Errors.MissingObjectException"></exception>
        /// <exception cref="System.IO.IOException"></exception>
        /// <exception cref="NGit.Errors.IncorrectObjectTypeException"></exception>
        private InputStream Open(WindowCursor wc)
        {
            InputStream delta;

            try
            {
                delta = new PackInputStream(pack, objectOffset + headerLength, wc);
            }
            catch (IOException)
            {
                // If the pack file cannot be pinned into the cursor, it
                // probably was repacked recently. Go find the object
                // again and open the stream from that location instead.
                //
                return(wc.Open(GetObjectId()).OpenStream());
            }
            delta = new InflaterInputStream(delta);
            ObjectLoader @base = pack.Load(wc, baseOffset);
            DeltaStream  ds    = new _DeltaStream_223(@base, wc, delta);

            // This code path should never be used as DeltaStream
            // is supposed to open the stream first, which would
            // initialize the size for us directly from the stream.
            if (type == Constants.OBJ_BAD)
            {
                if (!(@base is NGit.Storage.File.LargePackedDeltaObject))
                {
                    type = @base.GetType();
                }
            }
            if (size == SIZE_UNKNOWN)
            {
                size = ds.GetSize();
            }
            return(ds);
        }
예제 #3
0
		/// <exception cref="NGit.Errors.MissingObjectException"></exception>
		/// <exception cref="System.IO.IOException"></exception>
		/// <exception cref="NGit.Errors.IncorrectObjectTypeException"></exception>
		private InputStream Open(WindowCursor wc)
		{
			InputStream delta;
			try
			{
				delta = new PackInputStream(pack, objectOffset + headerLength, wc);
			}
			catch (IOException)
			{
				// If the pack file cannot be pinned into the cursor, it
				// probably was repacked recently. Go find the object
				// again and open the stream from that location instead.
				//
				return wc.Open(GetObjectId()).OpenStream();
			}
			delta = new InflaterInputStream(delta);
			ObjectLoader @base = pack.Load(wc, baseOffset);
			DeltaStream ds = new _DeltaStream_223(@base, wc, delta);
			// This code path should never be used as DeltaStream
			// is supposed to open the stream first, which would
			// initialize the size for us directly from the stream.
			if (type == Constants.OBJ_BAD)
			{
				if (!(@base is NGit.Storage.File.LargePackedDeltaObject))
				{
					type = @base.GetType();
				}
			}
			if (size == SIZE_UNKNOWN)
			{
				size = ds.GetSize();
			}
			return ds;
		}
예제 #4
0
		/// <exception cref="NGit.Errors.MissingObjectException"></exception>
		/// <exception cref="System.IO.IOException"></exception>
		public override ObjectStream OpenStream()
		{
			WindowCursor wc = new WindowCursor(db);
			InputStream @in;
			try
			{
				@in = new PackInputStream(pack, objectOffset + headerLength, wc);
			}
			catch (IOException)
			{
				// If the pack file cannot be pinned into the cursor, it
				// probably was repacked recently. Go find the object
				// again and open the stream from that location instead.
				//
				return wc.Open(GetObjectId(), type).OpenStream();
			}
			@in = new BufferedInputStream(new InflaterInputStream(@in, wc.Inflater(), 8192), 
				8192);
			//
			//
			//
			//
			//
			return new ObjectStream.Filter(type, size, @in);
		}