예제 #1
0
        internal override IProducerConsumer CreatePullChain(TextReader input, ConverterReader converterReader)
        {
            this.inputEncoding  = Encoding.Unicode;
            this.outputEncoding = Encoding.Unicode;
            ConverterInput  input2 = new ConverterUnicodeInput(input, false, this.maxHtmlTagSize, base.TestBoundaryConditions, converterReader);
            ConverterOutput output = new ConverterUnicodeOutput(converterReader, false, false);

            return(this.CreateChain(input2, output, converterReader));
        }
 protected override void Dispose()
 {
     if (cache != null && cache is IDisposable)
     {
         ((IDisposable)cache).Dispose();
     }
     cache    = null;
     pushSink = null;
     pullSink = null;
     base.Dispose();
 }
예제 #3
0
        internal override IProducerConsumer CreatePullChain(Stream input, ConverterReader converterReader)
        {
            if (this.inputEncoding == null)
            {
                throw new InvalidOperationException(TextConvertersStrings.InputEncodingRequired);
            }
            this.outputEncoding = Encoding.Unicode;
            ConverterInput  input2 = new ConverterDecodingInput(input, false, this.inputEncoding, this.detectEncodingFromByteOrderMark, this.maxHtmlTagSize, this.testMaxHtmlRestartOffset, base.InputStreamBufferSize, base.TestBoundaryConditions, this, converterReader);
            ConverterOutput output = new ConverterUnicodeOutput(converterReader, false, true);

            return(this.CreateChain(input2, output, converterReader));
        }
 public ConverterUnicodeOutput(object destination, bool push, bool restartable)
 {
     if (push)
     {
         pushSink = (destination as TextWriter);
     }
     else
     {
         pullSink = (destination as ConverterReader);
         pullSink.SetSource(this);
     }
     canRestart       = restartable;
     this.restartable = restartable;
 }
예제 #5
0
        /// <summary>
        /// Converts the specified source reader.
        /// </summary>
        /// <param name="sourceReader">The source reader.</param>
        /// <param name="destinationWriter">The destination writer.</param>
        public void Convert(TextReader sourceReader, TextWriter destinationWriter)
        {
            if (destinationWriter == null)
            {
                throw new ArgumentNullException("destinationWriter");
            }
            TextReader textReader = new ConverterReader(sourceReader, this);

            char[] array = new char[4096];
            while (true)
            {
                int num = textReader.Read(array, 0, array.Length);
                if (num == 0)
                {
                    break;
                }
                destinationWriter.Write(array, 0, num);
            }
            destinationWriter.Flush();
        }
예제 #6
0
 /// <summary>
 /// Creates the pull chain.
 /// </summary>
 /// <param name="input">The input TextReader.</param>
 /// <param name="converterReader">The converter reader.</param>
 /// <returns>An <see cref="T:Microsoft.Exchange.Data.TextConverters.IProducerConsumer" /> for use in a chain.</returns>
 internal abstract IProducerConsumer CreatePullChain(TextReader input, ConverterReader converterReader);