The Labs \ Source Viewer \ SSCLI \ System.Xml.Xsl.XsltOld \ TextOutput

  1. //------------------------------------------------------------------------------
  2. // <copyright file="TextOutput.cs" company="Microsoft">
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. // </copyright>
  14. //------------------------------------------------------------------------------
  15. namespace System.Xml.Xsl.XsltOld
  16. {
  17.     using Res = System.Xml.Utils.Res;
  18.     using System;
  19.     using System.IO;
  20.     using System.Xml;
  21.     using System.Xml.XPath;
  22.     using System.Text;
  23.    
  24.     internal class TextOutput : SequentialOutput
  25.     {
  26.         private TextWriter writer;
  27.        
  28.         internal TextOutput(Processor processor, Stream stream) : base(processor)
  29.         {
  30.             if (stream == null) {
  31.                 throw new ArgumentNullException("stream");
  32.             }
  33.            
  34.             this.encoding = processor.Output.Encoding;
  35.             this.writer = new StreamWriter(stream, this.encoding);
  36.         }
  37.        
  38.         internal TextOutput(Processor processor, TextWriter writer) : base(processor)
  39.         {
  40.             if (writer == null) {
  41.                 throw new ArgumentNullException("writer");
  42.             }
  43.            
  44.             this.encoding = writer.Encoding;
  45.             this.writer = writer;
  46.         }
  47.        
  48.         internal override void Write(char outputChar)
  49.         {
  50.             this.writer.Write(outputChar);
  51.         }
  52.        
  53.         internal override void Write(string outputText)
  54.         {
  55.             this.writer.Write(outputText);
  56.         }
  57.        
  58.         internal override void Close()
  59.         {
  60.             this.writer.Flush();
  61.             this.writer = null;
  62.         }
  63.     }
  64. }

Developer Fusion