コード例 #1
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);
 }
コード例 #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;
		}
コード例 #3
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);
 }
コード例 #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);
        }