Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Optimizing research on file type
Message
From
17/11/2016 08:50:16
 
 
To
14/01/2016 10:42:57
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:
01643606
Views:
39
I have adjusted the top portion of the class to use the FileStream. Basically, I only need to top 2048 characters. So, once I have that, I simply put that into lcString and the rest of the code is simply as it has always been.
Try

   ' Get it into a stream
   loFile = New FileStream(lcFile, FileMode.Open, FileAccess.Read, FileShare.Read)

   ' If we can work with the file
   If loFile.CanSeek Then

      ' Initialization
      lnLength = loFile.Length

      ' Number of bytes to read
      lnByteToRead = 2048

      ' Maximum number of bytes to read
      If lnLength < 2048 Then
         lnByteToRead = lnLength
      End If

      ' Get the byte-order mark, if there is one
      loByte = New Byte(lnByteToRead) {}

      loFile.Read(loByte, 0, lnByteToRead - 1)
   Else
      cMessage = cUnableToReadTheFile
      Clear()
      Return False
   End If

   ' Close the file
   loFile.Close()

Catch loError As Exception
End Try

' Initialization
lcString = Encoding.Default.GetString(loByte)
So, that part is faster. However, I found out the biggest latency, on a specific ZIP file contains 31,000 files is when I do the unzip by using the WinZip Command Prompt utility. I will have to look at that.
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