I'm using an HttpWebResponse object to make an HTTP Request. I then open a StreamReader object to read in the text. If I use stream.Read(charArr, 0, 10000), less than 10000 characters are read in. When I use stream.ReadToEnd(), all 45+ million characters are returned so I know there is more than 10000 characters in the stream. Here is a snippet of my code:
using(StreamReader stream = new StreamReader(httpResponse.getResponseStream()))
{
int charsToRead = 10000;
char[] charArr = new char[charsToRead];
int charsRead = stream.Read(charArr, 0, charsToRead);
//charsRead is never 10000 even though the response stream is over 45,000,000 lines long
}
Any ideas on why the StreamReader.Read method won't read in the number of characters I tell it to would be greatly appreciated.