Example #1
0
 /// <exception cref="NGit.Errors.TransportException"></exception>
 public ForkLocalPushConnection(TransportLocal _enclosing)
     : base(_enclosing)
 {
     this._enclosing = _enclosing;
     MessageWriter msg = new MessageWriter();
     this.SetMessageWriter(msg);
     this.receivePack = this._enclosing.Spawn(this._enclosing.GetOptionReceivePack());
     InputStream rpErr = this.receivePack.GetErrorStream();
     this.errorReaderThread = new StreamCopyThread(rpErr, msg.GetRawStream());
     this.errorReaderThread.Start();
     InputStream rpIn = this.receivePack.GetInputStream();
     OutputStream rpOut = this.receivePack.GetOutputStream();
     rpIn = new BufferedInputStream(rpIn);
     rpOut = new SafeBufferedOutputStream(rpOut);
     this.Init(rpIn, rpOut);
     this.ReadAdvertisedRefs();
 }
			/// <exception cref="NGit.Errors.TransportException"></exception>
			public TcpPushConnection(TransportGitAnon _enclosing) : base(_enclosing)
			{
				this._enclosing = _enclosing;
				this.sock = this._enclosing.OpenConnection();
				try
				{
					InputStream sIn = this.sock.GetInputStream();
					OutputStream sOut = this.sock.GetOutputStream();
					sIn = new BufferedInputStream(sIn);
					sOut = new BufferedOutputStream(sOut);
					this.Init(sIn, sOut);
					this._enclosing.Service("git-receive-pack", this.pckOut);
				}
				catch (IOException err)
				{
					this.Close();
					throw new TransportException(this.uri, JGitText.Get().remoteHungUpUnexpectedly, err
						);
				}
				this.ReadAdvertisedRefs();
			}
		/// <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);
		}
Example #4
0
				/// <exception cref="NGit.Errors.MissingObjectException"></exception>
				/// <exception cref="System.IO.IOException"></exception>
				public override ObjectStream OpenStream()
				{
					FileInputStream @in = new FileInputStream(p);
					long sz = @in.GetChannel().Size();
					int type = this.GetType();
					BufferedInputStream b = new BufferedInputStream(@in);
					return new ObjectStream.Filter(type, sz, b);
				}
Example #5
0
				/// <exception cref="NGit.Errors.MissingObjectException"></exception>
				/// <exception cref="System.IO.IOException"></exception>
				public override ObjectStream OpenStream()
				{
					InputStream @in = this._enclosing.ptr.OpenEntryStream();
					@in = new BufferedInputStream(@in);
					return new ObjectStream.Filter(this.GetType(), this.GetSize(), @in);
				}
		/// <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);
		}
Example #7
0
 /// <exception cref="NGit.Errors.TransportException"></exception>
 public ForkLocalFetchConnection(TransportLocal _enclosing)
     : base(_enclosing)
 {
     this._enclosing = _enclosing;
     MessageWriter msg = new MessageWriter();
     this.SetMessageWriter(msg);
     this.uploadPack = this._enclosing.Spawn(this._enclosing.GetOptionUploadPack());
     InputStream upErr = this.uploadPack.GetErrorStream();
     this.errorReaderThread = new StreamCopyThread(upErr, msg.GetRawStream());
     this.errorReaderThread.Start();
     InputStream upIn = this.uploadPack.GetInputStream();
     OutputStream upOut = this.uploadPack.GetOutputStream();
     upIn = new BufferedInputStream(upIn);
     upOut = new BufferedOutputStream(upOut);
     this.Init(upIn, upOut);
     this.ReadAdvertisedRefs();
 }
Example #8
0
				/// <exception cref="NGit.Errors.MissingObjectException"></exception>
				/// <exception cref="System.IO.IOException"></exception>
				public override ObjectStream OpenStream()
				{
					long contentLength = this._enclosing.ptr.GetEntryContentLength();
					InputStream @in = this._enclosing.ptr.OpenEntryStream();
					@in = new BufferedInputStream(@in);
					return new ObjectStream.Filter(this.GetType(), contentLength, @in);
				}