Class MultiFileTextReader
A text reader which virtually concatenates a number of text files and allows sequential reading from this file set.
Implements
Inherited Members
Namespace: SdlSdl.LanguagePlatformIO
Assembly: Sdl.LanguagePlatform.IO.dll
Syntax
public class MultiFileTextReader : TextReader, IDisposable
Constructors
MultiFileTextReader(DirectoryInfo, string, bool)
Instantiates a MultiFileTextReader which works on the files contained in the specified directory and its subdirectories.
Declaration
public MultiFileTextReader(DirectoryInfo rootDirectory, string fileFilter, bool recurse)
Parameters
Type | Name | Description |
---|---|---|
DirectoryInfo | rootDirectory | The directory in which to search for applicable files. |
string | fileFilter | If non-null, only files which match the filter are added to the file set (see System.IO.DirectoryInfo.GetFiles()). |
bool | recurse | If true, subdirectories are scanned for matching false. Otherwise, only files in the specified root directory are considered. |
MultiFileTextReader(params FileInfo[])
Instantiates a MultiFileTextReader which works on the specified set of files. The files are opened with BOM sniffing defaulting to UTF8 encoding.
Declaration
public MultiFileTextReader(params FileInfo[] files)
Parameters
Type | Name | Description |
---|---|---|
FileInfo | files |
MultiFileTextReader(params string[])
Instantiates a MultiFileTextReader which works on the files or directories passed as the parameter. Directories are recursed into, files are opened UTF8 with BOM sniffing.
Declaration
public MultiFileTextReader(params string[] filesOrDirectories)
Parameters
Type | Name | Description |
---|---|---|
string | filesOrDirectories | The set of file names or directory names to work on |
Properties
CurrentFile
Allows access to the FileInfo of the currently worked-on file. If null, EOF has been reached.
Declaration
public FileInfo CurrentFile { get; }
Property Value
Type | Description |
---|---|
FileInfo |
Methods
Close()
Closes the overall file set. An attempt to read more data will lead to an exception.
Declaration
public override void Close()
Overrides
Peek()
Not implemented.
Declaration
public override int Peek()
Returns
Type | Description |
---|---|
int | Always throws exception. |
Overrides
Read()
Reads the next character from the set of input files, advances the current file as necessary.
Declaration
public override int Read()
Returns
Type | Description |
---|---|
int | The next input character or -1 if EOF (of the concatenation) is reached. |
Overrides
Read(char[], int, int)
Reads a block of characters from the virtual concatenation of text files.
Declaration
public override int Read(char[] buffer, int index, int count)
Parameters
Type | Name | Description |
---|---|---|
char | buffer | The buffer to store the data in (see TextReader.Read()) |
int | index | The index to start storing characters in the buffer. |
int | count | The maximum number of characters to read |
Returns
Type | Description |
---|---|
int | 0 on EOF, or the number of characters read which may be 0 < n <= count |
Overrides
ReadBlock(char[], int, int)
Reads a block of characters from the virtual concatenation of text files.
Declaration
public override int ReadBlock(char[] buffer, int index, int count)
Parameters
Type | Name | Description |
---|---|---|
char | buffer | The buffer to store the data in (see TextReader.Read()) |
int | index | The index to start storing characters in the buffer |
int | count | The number of characters to read |
Returns
Type | Description |
---|---|
int | The number of characters read. Unlike Read(buffer, index, count), this method will always attempt to read count characters and will automatically advance to the next file if the current file does not contain enough data. |
Overrides
ReadLine()
Reads the next line of input from the concatenation of text files.
Declaration
public override string ReadLine()
Returns
Type | Description |
---|---|
string |
Overrides
ReadToEnd()
Not implemented.
Declaration
public override string ReadToEnd()
Returns
Type | Description |
---|---|
string | Always throws exception. |