Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Optimizing research on file type
Message
From
18/01/2016 15:08:09
 
 
To
14/01/2016 11:57:20
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
VB 9.0
OS:
Windows 8.1
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01629800
Message ID:
01629898
Views:
21
>(1) make the FileStream a class property
>(2) add a byte[] Buffer as a class property

I assume the usage of propery would be to avoid declaring the types at each request. Is that correct?

>(3) Add a method IsByteEqual ( int fileOffset, int value)
>
>if ( fileOffset +1 > length of the buffer )
>    read a buffer starting a file offset 0, size = fileOffset +1 rounded to a multiple of 4 k ( or 16 k)
>
>return buffer[fileOffset ] ==value
>
>You will need to clear the buffer each time you open a new file
>
>(4) sample
>
>if( IsByteEqual(0, 0x45) andalso IsByteEqual(1, 0x64) )
>  filetype = something
>else if if( IsByteEqual(0, 0c80) andalso IsByteEqual(24, 0x88) )
> filetype = somethingelse
>.....
>else
> filetype = undefined
>
Thanks, I will see about seeking only at the proper locations.

However, some advanced logic, such as determining a zip file type requires more processing and for particular ones like that, I am not sure if a seek would suffice.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform