public bool TrySetEncoding(Encoding encoding)
 {
     if (encoding == this.encoding)
     {
         return(true);
     }
     if (this.stream == null)
     {
         return(false);
     }
     this.encoding = encoding;
     this.stoppable.Stop();
     while (true)
     {
         int num = this.reader.Read();
         if (num == -1)
         {
             break;
         }
         this.AppendChar((char)num);
     }
     this.stoppable = new StoppableStream(this.stream);
     this.reader    = new StreamReader(this.stoppable, encoding, false);
     return(true);
 }
Exemplo n.º 2
0
		public bool TrySetEncoding(Encoding encoding)
		{
			if (encoding == this.encoding)
			{
				return true;
			}
			if (this.stream == null)
			{
				return false;
			}
			this.encoding = encoding;
			this.stoppable.Stop();
			while (true)
			{
				int num = this.reader.Read();
				if (num == -1)
				{
					break;
				}
				this.AppendChar((char)num);
			}
			this.stoppable = new StoppableStream(this.stream);
			this.reader = new StreamReader(this.stoppable, encoding, false);
			return true;
		}
 public LazyTextReader(Stream stream, Encoding initialEncoding)
 {
     this.encoding  = initialEncoding;
     this.stream    = stream;
     this.stoppable = new StoppableStream(stream);
     this.reader    = new StreamReader(this.stoppable, initialEncoding ?? Encoding.UTF8, true, 512);
 }
Exemplo n.º 4
0
		public LazyTextReader(Stream stream, Encoding initialEncoding)
		{
			this.encoding = initialEncoding;
			this.stream = stream;
			this.stoppable = new StoppableStream(stream);
            this.reader = new StreamReader(this.stoppable, initialEncoding ?? Encoding.UTF8, true, 512);
        }