You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
'Private Function EstimateCompressabilityHDD(input As FileStream, fileSize As Long, compressionFactory As CompressionStreamFactory, Optional cancellationToken As Threading.CancellationToken = Nothing) As Double
145
+
' Dim MiddleChunkSize As Integer = SampleSize * BlockSize ' 10KB
146
+
147
+
' Dim totalWritten As Long = 0
148
+
' Dim compressed = New MemoryStream()
149
+
150
+
' Using compressionStream As Stream = compressionFactory(compressed)
151
+
' ' If file is smaller than 10KB, just use the whole file
152
+
' Dim chunkSize As Integer = CInt(Math.Min(MiddleChunkSize, fileSize))
153
+
' Dim middleStart As Long = Math.Max(0, (fileSize \ 2) - (chunkSize \ 2))
154
+
155
+
' Dim buffer(chunkSize - 1) As Byte
156
+
' input.Position = middleStart
157
+
' Dim bytesRead As Integer = input.Read(buffer, 0, chunkSize)
158
+
159
+
' If cancellationToken <> Nothing AndAlso cancellationToken.IsCancellationRequested Then
160
+
' Throw New OperationCanceledException(cancellationToken)
0 commit comments