private void growBuffer()
{
byte[] newbuf;
int effinc; // effective increment
effinc = inc;
if (buf.Length + effinc > maxsize)
effinc = maxsize - buf.Length;
if (effinc <= 0)
{
throw new System.IO.IOException("Reached maximum cache size (" + maxsize + ")");
}
try
{
newbuf = new byte[buf.Length + inc];
}
catch (System.OutOfMemoryException e)
{
throw new System.IO.IOException("Out of memory to cache input data");
}
Array.Copy(buf, 0, newbuf, 0, len);
buf = newbuf;
}