Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Optimizing research on file type
Message
De
18/01/2016 15:08:09
 
 
À
14/01/2016 11:57:20
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
VB 9.0
OS:
Windows 8.1
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01629800
Message ID:
01629898
Vues:
22
>(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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform