Returns a clone of this stream.
///
/// Clones of a stream access the same data, and are positioned at the same
/// point as the stream they were cloned from.
///
///
Expert: Subclasses must ensure that clones may be positioned at
/// different points in the input from each other and from the stream they
/// were cloned from.
///
public virtual System.Object Clone()
{
InputStream clone = null;
try
{
clone = (InputStream) this.MemberwiseClone();
}
catch (System.Exception e)
{
throw new Exception("Can't clone InputStream.", e);
}
if (buffer != null)
{
clone.buffer = new byte[BUFFER_SIZE];
Array.Copy(buffer, 0, clone.buffer, 0, bufferLength);
}
clone.chars = null;
return clone;
}
static InputStream()
{
BUFFER_SIZE = OutputStream.BUFFER_SIZE;
}
}
}