.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

BinaryReader - BigEndian to LittleEndian

Posted By:      Posted Date: October 14, 2010    Points: 0   Category :.NET Framework

I need to read BigEndian from a BinaryReader into LittleEndian and vice/versa. The data throughout the original binary file has mixed endianness so I need to flip back and forth as I read.


I have seen one post that suggest deriving a class from BinaryReader and overriding the various Read methods. YUCK!


Please tell me their is a way to tell the stream to flip from one endianness to the other, and back (Qt can do it!).


Thanks in advance,



View Complete Post

More Related Resource Links

Slow BinaryReader Position Change Time


Hello, I have a question about basically a laggy position change time with a large file (actually, in this case I'm using a 20GB or so disk drive).  Basically what I'm doing is writing my own class that uses the CreateFile function to read raw data from a local disk drive, and then have an extract file class that allows me to seek to blocks (the file system is FAT) that the file occupies, then read the data, piece it together, etc.  I noticed though, that when extracting an 800KB file, it took about 10 seconds to do the process, and the main cause was that changing my reader's position took anywhere from 250 milliseconds to one complete second.

The short version: When extracting a file using my own classes, it took way longer than it should have, and the cause is changing the IO's position.


The code is exactly as you'd probably imagine:

for (int i = 0; i < f.BlocksOccupied.Length - 1; i++)
          br.BaseStream.Position = m.GetBlockOffset(f.BlocksOccupied[i], f.PartInfo);
So what I am asking is if there is any way to speed up the process of moving my posit
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend