public override void SetLength (long value)
{
if (closed)
throw new ObjectDisposedException("The stream is closed");
if (value < 0)
throw new ArgumentOutOfRangeException("length", "Non-negative number required.");
if (value > capacity)
throw new IOException ("Unable to expand length of this stream beyond its capacity.");
if (fileaccess == FileAccess.Read)
throw new NotSupportedException ("Stream does not support writing.");
length = value;
if (length < current_position)
current_position = length;
}