Detect Structured Storage Format

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am writing an application in C# I have file converted to stream.

I need to find out the type of office file (prior to office 2007)

I need to do this using streams I know hoe to do this using byte[].

Thanks
 
I am writing an application in C# I have file converted to stream.

I need to find out the type of office file (prior to office 2007)

I need to do this using streams I know hoe to do this using byte[].

Would a MemoryStream class work?
 
Memeory Stream is a byte array internally right if I have a large file it
will still be an isuue.

Thanks

Patrick Steele said:
I am writing an application in C# I have file converted to stream.

I need to find out the type of office file (prior to office 2007)

I need to do this using streams I know hoe to do this using byte[].

Would a MemoryStream class work?
 
Ok -- lets back up. What exactly do you need to do?

It sounded like you've got a technique for detecting a file type by
looking at a byte[], but now that you've got a Stream instead of a File,
you're stuck?

Memeory Stream is a byte array internally right if I have a large file it
will still be an isuue.

Thanks

Patrick Steele said:
I am writing an application in C# I have file converted to stream.

I need to find out the type of office file (prior to office 2007)

I need to do this using streams I know hoe to do this using byte[].

Would a MemoryStream class work?
 
Yes you are right not that I have stream I am stuck.
problem is when I get these huge files which I dont want to convert to byte
array.
If the file is 2007 office document it is simple we can read XML data.But
for previous versions I could not figure out.

Thanks
Ajit


Patrick Steele said:
Ok -- lets back up. What exactly do you need to do?

It sounded like you've got a technique for detecting a file type by
looking at a byte[], but now that you've got a Stream instead of a File,
you're stuck?

Memeory Stream is a byte array internally right if I have a large file it
will still be an isuue.

Thanks

Patrick Steele said:
I am writing an application in C# I have file converted to stream.

I need to find out the type of office file (prior to office 2007)

I need to do this using streams I know hoe to do this using byte[].

Would a MemoryStream class work?
 
Yes you are right not that I have stream I am stuck.
problem is when I get these huge files which I dont want to convert to byte
array.
If the file is 2007 office document it is simple we can read XML data.But
for previous versions I could not figure out.

Use the "Read" method on the Stream to pull out the first 100 or so
bytes (however many your detection routine needs) into a byte[]. Close
the Stream, do your detection and then decide how to proceed.
 
Back
Top