April 24th, 2010, 09:32 AM
What does disk IO do to a string and how can it be replicated?
This is NOT intended to be a "bump." I cannot edit my original post, and after being away from the problem for a few hours, I reliazed my first post was confusing to anyone who wasn't in my mind. This is more simplified. I am new here, and apologize in advance if this is against protocol. I would edit my original post if I had the ability to. Thanks for understanding.
Thanks for taking the time to read this. I am stumped and at wit's end! I'm developing a limited NNTP client to download multi-part y-Enc binary data. Obviously, the parts have to be decoded and processed and hashed and crc'd. With so many IO streams, I'm trying to find a way of keeping the segments in memory until time for joining. That's where the trouble is.
I have the data for each segment stored in a generic list of strings (in 3.5).
Now, if I save the string to disk and then load them in the same order, the process WORKS FINE:
StreamWriter sw = new StreamWriter(FilePath, false, Encoding.GetEncoding("iso-8859-1")); sw.Write(segData[i]); sw.Close();
input = new StreamReader(FilePath, Encoding.GetEncoding("iso-8859-1"));
Once again, the above code works fine, but the whole point of this thing is to AVOID saving the individual segments to the disk.
I've tried everything I can think of to avoid the process:
byte byteArray = Encoding.GetEncoding("iso-8859-1").GetBytes(segData[i]);
MemoryStream ms = new MemoryStream(byteArray);
SHOULD work in my mind, but it doesn't -- I get CRC errors in the joining and processing.
If you can think of what the write/read cycle is doing to the data to make it work, I would really appreciate it, because this is just WAY frustrating to me.
Thanks in advance for any help or information you can provide.
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.