Class DirectorySampleStream
The directory sample stream allows for creating a stream from a directory listing of files.
public class DirectorySampleStream : ObjectStreamBase<FileInfo?>, IObjectStream<FileInfo?>, IDisposable
- Inheritance
-
DirectorySampleStream
- Implements
- Inherited Members
Constructors
DirectorySampleStream(DirectoryInfo, Func<FileSystemInfo, bool>?, bool)
Creates a new directory sample stream.
public DirectorySampleStream(DirectoryInfo dir, Func<FileSystemInfo, bool>? fileFilter, bool recursive)
Parameters
dirDirectoryInfoThe directory.
fileFilterFunc<FileSystemInfo, bool>The filter to apply while enumerating files.
recursiveboolEnables or disables recursive file listing.
DirectorySampleStream(DirectoryInfo[], Func<FileSystemInfo, bool>?, bool)
Creates a new directory sample stream.
public DirectorySampleStream(DirectoryInfo[] dirs, Func<FileSystemInfo, bool>? fileFilter, bool recursive)
Parameters
dirsDirectoryInfo[]The directories to read.
fileFilterFunc<FileSystemInfo, bool>The filter to apply while enumerating files.
recursiveboolEnables or disables recursive file listing.
Methods
Dispose(bool)
Calling this function has no effect on the stream.
protected override void Dispose(bool disposing)
Parameters
disposingbool
Read()
Returns the next object. Calling this method repeatedly until it returns
null will return each object from the underlying source exactly once.
public override FileInfo? Read()
Returns
- FileInfo
the next object or
nullto signal that the stream is exhausted
Exceptions
- IOException
if there is an error during reading
- IOException
if there is an error during reading
Reset()
Repositions the stream at the beginning and the previously seen object sequence will be repeated exactly. This method can be used to re-read the stream if multiple passes over the objects are required.
The implementation of this method is optional.
public override void Reset()
Exceptions
- IOException
if there is an error during resetting the stream
- NotSupportedException
if reset is not supported on this stream