Parameters
- file
- The file to inspect.
- chunkSize
- The size of the chunks to read in bytes. The default is 4096 bytes, chosen to balance efficiency and memory usage.
Return Value
The number of padding bytes found at the end of the file.
Exception | Description |
---|---|
System.ArgumentNullException | Thrown if the file argument is null. |
System.IO.FileNotFoundException | Thrown if the file does not exist. |
System.ArgumentException | If the file does not exists |
System.ArgumentNullException | If fileis null |
FileInfo file = new FileInfo(@"path\to\your\file.ext"); long paddingBytes = file.CountPaddingBytesChunked(); Console.WriteLine($"The file contains {paddingBytes * 100.0 / file.Length:0.0}% padding bytes at the end.");
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2