public void SetOutput (Stream stream, Encoding encoding, bool ownsStream)
{
if (stream == null)
throw new ArgumentNullException ("stream");
if (encoding == null)
throw new ArgumentNullException ("encoding");
output = stream;
this.encoding = encoding;
close_output = ownsStream;
}