J
Jonathan Wood
Greetings,
I'm still pretty new to .NET streams and wondered if someone could offer
some suggestions.
Currently, I'm using StreamReader to reading a text file line by line. When
I reach a particular line, I'd like to compute an MD5 hash for the entire
file from that line on, and then I need to continue reading line by line
from the same place I left off.
I see that MD5.ComputerHash() takes a stream object, which I can obtain
using StreamReader.BaseStream. However, because StreamReader uses buffered
read, the seek position in BaseStream does not represent the current
position in the StreamReader. And, since StreamReader, has no Position or
Seek members, I don't see how I could return to my previous position.
Note that these files can be around 10MB so I'd prefer not to load the
entire file into memory.
Any suggestions?
Thanks.
Jonathan
I'm still pretty new to .NET streams and wondered if someone could offer
some suggestions.
Currently, I'm using StreamReader to reading a text file line by line. When
I reach a particular line, I'd like to compute an MD5 hash for the entire
file from that line on, and then I need to continue reading line by line
from the same place I left off.
I see that MD5.ComputerHash() takes a stream object, which I can obtain
using StreamReader.BaseStream. However, because StreamReader uses buffered
read, the seek position in BaseStream does not represent the current
position in the StreamReader. And, since StreamReader, has no Position or
Seek members, I don't see how I could return to my previous position.
Note that these files can be around 10MB so I'd prefer not to load the
entire file into memory.
Any suggestions?
Thanks.
Jonathan