示例#1
0
 /// <summary>
 /// Changes the <Fld>ReadState</Fld> to Closed.
 /// </summary>
 /// <remarks>
 /// This method changes ReadState to Closed and also releases any resources held while reading 
 /// including calling Close on the underlying stream.  If Close has already been called, 
 /// no action is performed.
 /// <para>
 /// The caller should no longer call methods on this object after calling <Mth>Close</Mth> or
 /// <Mth>Dispose</Mth>.
 /// </para>
 /// </remarks>
 internal void Close()
 {
     m_readState = ReadState.Closed;
     if (m_streamReader != null)
     {
         m_streamReader.BaseStream.Close();
         m_streamReader.Close();
         m_streamReader = null;
     }
     if (m_htmlNodeParser != null)
     {
         m_htmlNodeParser.Close();
         m_htmlNodeParser = null;
     }
 }
示例#2
0
 /// <summary>
 /// Initializes a new instance of <Typ>HtmlTextReader</Typ>.
 /// </summary>
 /// <remarks>
 /// The caller should ensure the <paramref name="stream"/> has an efficient, high performance, ReadByte()
 /// method.  For instance, use <Typ>BufferedStream</Typ>.  The <paramref name="stream"/> must be readable 
 /// and seekable.
 /// </remarks>
 /// <exception cref="ArgumentException">The <paramref name="stream"/>is invalid (not readable or not seekable.)</exception>
 /// <exception cref="ArgumentNullException">The <paramref name="stream"/> is null.</exception>
 /// <param name="stream">Stream containing the data to parse.</param>
 internal HtmlTextReader(Stream stream)
 {
     if (stream == null) throw new ArgumentNullException("stream");
     if (!stream.CanRead || !stream.CanSeek) throw new ArgumentException(Resources.StreamMustReadAndSeek, "stream");
     m_streamReader = new StreamReader(stream);
     m_htmlNodeParser = new HtmlNodeParser(m_streamReader);
     m_nameTable = new NameTable();
     m_xmlNamespaceManager = new XmlNamespaceManager(m_nameTable);
 }