System.Net.WebConnectionStream.CheckWriteOverflow C# (CSharp) Method

CheckWriteOverflow() static private method

static private CheckWriteOverflow ( long contentLength, long totalWritten, long size ) : void
contentLength long
totalWritten long
size long
return void
		void CheckWriteOverflow (long contentLength, long totalWritten, long size)
		{
			if (contentLength == -1)
				return;

			long avail = contentLength - totalWritten;
			if (size > avail) {
				KillBuffer ();
				nextReadCalled = true;
				cnc.Close (true);
				throw new ProtocolViolationException (
					"The number of bytes to be written is greater than " +
					"the specified ContentLength.");
			}
		}