namespace NTFSExtensions
public static class Compression
GetAllocatedRanges
Returns an enumeration of allocated regions in a stream.
Signatures
public static IEnumerable<Range> GetAllocatedRanges(this FileStream FS)
public static IEnumerable<Range> GetAllocatedRanges(this FileStream FS, Range Range)
public static IEnumerable<Range> GetAllocatedRanges(SafeFileHandle FileStream, Range Range)
Parameters
this FileStream FS
- A FileStream object as a reference to opened stream. You may call this method directly from this object, because this is an extension method.
SafeFileHandle FileStream
- Handle to opened stream. You can become this handle from file stream object or using WinAPI function CreateFile.
Range Range
- A range in a stream were you want to enumerate allocated regions
Returns
Function returns an enumeration of occupied regions. If stream is saved as plain data, only one region exists. Sparse streams can contain many allocated ranges.
Remarks
Scans a file or alternate stream looking for allocated ranges that may contain nonzero data. Only compressed or sparse files can have zeroed ranges known to the operating system. For other files, the output buffer will contain only a single entry that contains the starting point and the length requested.
Example
Example for working with compressed streams