Right, but mime/email is a text format. But anyway, I can also see some case why it might be necessary to read a text format without encoding.
The char buffer will encode. If that is really that important to avoid, I think you need a byte buffer and scanning for your end of line byte sequences. -----Original Message----- From: Unmoderated discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] On Behalf Of dave wanta Sent: Thursday, April 14, 2005 11:45 AM To: [email protected] Subject: Re: [ADVANCED-DOTNET] BinaryReader ReadLine() ?!? but the lines aren't meaningless. There are other rules of the file format that rely on lines. i.e. Mime/Email. Emails can change encodings for different parts, yet the headers/boundaries are based upon lines. Like I said, I have all this working, in a proof of concept, i'm really just looking to increase perf. So i'm planning on implementing a char[] buffer under the covers. Just looking for some tips/pointers before I go and re-invent the wheel. Thanks a bunch for all the feedback. Cheers! Dave ----- Original Message ----- From: "Bob Provencher" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Thursday, April 14, 2005 10:29 AM Subject: Re: [ADVANCED-DOTNET] BinaryReader ReadLine() ?!? > Ok, got it now. You want to read a file you know is some encoding of text, > without changing encodings -- possibly because you don't necessarily > know what encoding you have? > > Makes sense, but unless you always treat them as byte arrays, sooner > or later you will need to change encodings or know the encoding you > want before > going to a string. > > If you are always treating them as byte arrays, I'd suggest that "lines" are > meaningless. > > -----Original Message----- > From: Unmoderated discussion of advanced .NET topics. > [mailto:[EMAIL PROTECTED] On Behalf Of dave wanta > Sent: Thursday, April 14, 2005 11:14 AM > To: [email protected] > Subject: Re: [ADVANCED-DOTNET] BinaryReader ReadLine() ?!? > > parsing text files that can change encodings. > > > > ----- Original Message ----- > From: "Bob Provencher" <[EMAIL PROTECTED]> > To: <[email protected]> > Sent: Thursday, April 14, 2005 10:08 AM > Subject: Re: [ADVANCED-DOTNET] BinaryReader ReadLine() ?!? > > > > But, the point is, there may not be any "lines" to read. You may > > get > lucky > > and find a string that looks like an EOL or you may not and blow out > > your buffers trying to read until you find one. > > > > Why not just read fixed length buffers instead of lines? Can you > > tell us what you are trying to do? > > > > -----Original Message----- > > From: Unmoderated discussion of advanced .NET topics. > > [mailto:[EMAIL PROTECTED] On Behalf Of dave wanta > > Sent: Thursday, April 14, 2005 10:46 AM > > To: [email protected] > > Subject: Re: [ADVANCED-DOTNET] BinaryReader ReadLine() ?!? > > > > 0x13 0x13, or 0x13, or 0x10. (Same as ReadLine() in StreamReader). > > > > Now, I realize that people say "BinaryReader is used for reading > > binary files". However, There is a ReadChar() and ReadChars() method. > > So, you > can > > build a ReadLine() method. I'm planning on doing just this, but will > > need > to > > maintain my own internal char buffer. I could call ReadChar() and > > just > keep > > checking for 0x13 and 0x10 (which I did as a quick proof of concept). > > However, when doing this against a file, you end up accessing the > > file for each char. > > > > I'm sure I'm not the only one who has needed to do this. Just > > looking for any tips/pointers, before I re-invent the wheel. > > > > Thanks, > > Dave > > > > > > ----- Original Message ----- > > From: "Philip Nelson" <[EMAIL PROTECTED]> > > To: <[email protected]> > > Sent: Thursday, April 14, 2005 9:35 AM > > Subject: Re: [ADVANCED-DOTNET] BinaryReader ReadLine() ?!? > > > > > > > What exactly constitutes a line in a binary file? > > > > > > --- dave wanta <[EMAIL PROTECTED]> wrote: > > > > Hi All, > > > > Has anyone ever implemented a ReadLine() method for a BinaryReader? > > > > I'm sure I'm not the only one implementing this, yet googling > > > > has turned up > > 0. > > > > > > > > > Philip - http://blogs.xcskiwinn.org/panmanphil > > > "There's a difference between righteous anger and just being crabby" > > > - > > Barbara > > > > > > =================================== > > > This list is hosted by DevelopMentorR http://www.develop.com > > > > > > View archives and manage your subscription(s) at > > http://discuss.develop.com > > > > > > > =================================== > > This list is hosted by DevelopMentorR http://www.develop.com > > > > View archives and manage your subscription(s) at > http://discuss.develop.com > > > > =================================== > > This list is hosted by DevelopMentorR http://www.develop.com > > > > View archives and manage your subscription(s) at > http://discuss.develop.com > > > > =================================== > This list is hosted by DevelopMentorR http://www.develop.com > > View archives and manage your subscription(s) at http://discuss.develop.com > > =================================== > This list is hosted by DevelopMentorR http://www.develop.com > > View archives and manage your subscription(s) at http://discuss.develop.com > =================================== This list is hosted by DevelopMentorR http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentor� http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com
