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.");
}
}